1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| #include<iostream> using namespace std;
struct Node { int num; int M; int N; };
int main() {
int n; cin >> n; int** p = new int* [n]; for (int i = 0; i < n; i++) { p[i] = new int[n]; }
Node* q = new Node[n];
for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> p[i][j]; } }
for (int i = 0; i < n; i++) { (q + i)->num = p[i][0]; (q + i)->M = i; (q + i)->N = 0; for (int j = 0; j < n; j++) { if (p[i][j] < (q + i)->num) { (q + i)->num = p[i][j]; (q + i)->N = j; } } }
Node size; size.num = q->num; for (int k = 0; k < n; k++) { if ((q + k)->num > size.num) { size.num = (q + k)->num; size.M = (q + k)->M; size.N = (q + k)->N; } }
for (int i = 0; i < n; i++) { delete[] p[i]; } delete[]p;
delete[]q;
cout << size.num << " " << size.M << " " << size.N; return 0; }
|