-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMEC.cpp
More file actions
50 lines (41 loc) · 950 Bytes
/
MEC.cpp
File metadata and controls
50 lines (41 loc) · 950 Bytes
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
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
#define N 40000
#define M 50
int n, m;
int s[M][N];
string b[N]; // dla ka\u017cdego zawodnika ci\u0105g zerojedynkowy
void wczytaj_dane() {
scanf("%d %d\n", &n, &m);
int c;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
scanf("%d", &c);
if (j != n - 1) scanf(" ");
s[i][j] = c - 1;
}
if (i != m - 1) scanf("\n");
}
}
void utworz_ciagi() {
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (j < n / 2) b[s[i][j]] += '0';
else b[s[i][j]] += '1';
}
}
}
bool posortuj_i_znajdz_te_same() {
sort(b, b + n);
for (int i = 0; i < n - 1; i++) if (b[i] == b[i + 1]) return false;
return true;
}
int main() {
wczytaj_dane();
utworz_ciagi();
if (posortuj_i_znajdz_te_same()) printf("TAK\n");
else printf("NIE\n");
return 0;
}