-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18868.h
46 lines (40 loc) · 853 Bytes
/
18868.h
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
#pragma once
#include <iostream>
using namespace std;
int M, N;
int P[10][100];
bool isEquivalent = true;
int total = 0;
int main_18868() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> M;
cin >> N;
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
cin >> P[i][j];
for (int i = 0; i < M; i++) {
for (int j = i + 1; j < M; j++) {
//i, j -> 비교하는 우주
isEquivalent = true;
for (int m = 0; m < N; m++) {
for (int n = m+1; n < N; n++) {
//m, n -> 비교하는 행성
bool result =
(P[i][m] > P[i][n] && P[j][m] > P[j][n]) ||
(P[i][m] == P[i][n] && P[j][m] == P[j][n]) ||
(P[i][m] < P[i][n] && P[j][m] < P[j][n]);
if (!result) {
isEquivalent = false;
m = N;
break;
}
}
}
if (isEquivalent)
total++;
}
}
cout << total << endl;
return 0;
}