#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,m,k;
cin >> n >> m >> k;
vector <string> arr(n);
bitset<4101> s[n];
for (int z=0;z<n;z++){
cin >> arr[z];
for (int x=0;x<m;x++){
if (arr[z][x] == 'A') s[z][x] = 1;
else s[z][x] = 0;
}
}
if (n <= 100){
for (int z=0;z<n;z++){
bool ok = true;
for (int x=0;x<n;x++){
if (z == x) continue;
ll c = 0;
for (int q=0;q<m;q++){
if (arr[z][q] != arr[x][q]) c++;
}
if (c != k){
ok = false;
break;
}
}
if (ok){
cout << z+1 << endl;
return 0;
}
}
} else {
for (int z=0;z<n;z++){
bool ok = true;
for (int x=0;x<n;x++){
if (z == x) continue;
bitset <4101> temp;
temp = s[z]^s[x];
ll c = temp.count();
if (c != k){
ok = false;
break;
}
}
if (ok){
cout << z+1 << endl;
return 0;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
380 KB |
Output is correct |
6 |
Correct |
5 ms |
456 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
9 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
306 ms |
3960 KB |
Output is correct |
2 |
Correct |
192 ms |
4728 KB |
Output is correct |
3 |
Correct |
482 ms |
4472 KB |
Output is correct |
4 |
Correct |
101 ms |
1656 KB |
Output is correct |
5 |
Correct |
57 ms |
4856 KB |
Output is correct |
6 |
Correct |
125 ms |
4740 KB |
Output is correct |
7 |
Correct |
57 ms |
2168 KB |
Output is correct |
8 |
Correct |
51 ms |
2168 KB |
Output is correct |
9 |
Correct |
32 ms |
4344 KB |
Output is correct |
10 |
Correct |
291 ms |
4472 KB |
Output is correct |
11 |
Correct |
84 ms |
3832 KB |
Output is correct |
12 |
Correct |
34 ms |
3832 KB |
Output is correct |
13 |
Correct |
79 ms |
3832 KB |
Output is correct |
14 |
Correct |
151 ms |
3320 KB |
Output is correct |
15 |
Correct |
65 ms |
3448 KB |
Output is correct |
16 |
Correct |
99 ms |
3448 KB |
Output is correct |
17 |
Correct |
176 ms |
4600 KB |
Output is correct |
18 |
Correct |
43 ms |
4472 KB |
Output is correct |
19 |
Correct |
178 ms |
4576 KB |
Output is correct |
20 |
Correct |
108 ms |
4472 KB |
Output is correct |
21 |
Correct |
278 ms |
4600 KB |
Output is correct |
22 |
Correct |
413 ms |
4472 KB |
Output is correct |
23 |
Correct |
448 ms |
4600 KB |
Output is correct |
24 |
Correct |
259 ms |
4472 KB |
Output is correct |
25 |
Correct |
73 ms |
4472 KB |
Output is correct |
26 |
Correct |
213 ms |
4600 KB |
Output is correct |
27 |
Correct |
133 ms |
4600 KB |
Output is correct |
28 |
Correct |
113 ms |
4520 KB |
Output is correct |
29 |
Correct |
272 ms |
4472 KB |
Output is correct |
30 |
Correct |
20 ms |
4728 KB |
Output is correct |
31 |
Correct |
22 ms |
4600 KB |
Output is correct |
32 |
Correct |
35 ms |
4728 KB |
Output is correct |
33 |
Correct |
5 ms |
376 KB |
Output is correct |
34 |
Correct |
5 ms |
376 KB |
Output is correct |
35 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
306 ms |
3960 KB |
Output is correct |
2 |
Correct |
192 ms |
4728 KB |
Output is correct |
3 |
Correct |
482 ms |
4472 KB |
Output is correct |
4 |
Correct |
101 ms |
1656 KB |
Output is correct |
5 |
Correct |
57 ms |
4856 KB |
Output is correct |
6 |
Correct |
125 ms |
4740 KB |
Output is correct |
7 |
Correct |
57 ms |
2168 KB |
Output is correct |
8 |
Correct |
51 ms |
2168 KB |
Output is correct |
9 |
Correct |
32 ms |
4344 KB |
Output is correct |
10 |
Correct |
291 ms |
4472 KB |
Output is correct |
11 |
Correct |
84 ms |
3832 KB |
Output is correct |
12 |
Correct |
34 ms |
3832 KB |
Output is correct |
13 |
Correct |
79 ms |
3832 KB |
Output is correct |
14 |
Correct |
151 ms |
3320 KB |
Output is correct |
15 |
Correct |
65 ms |
3448 KB |
Output is correct |
16 |
Correct |
99 ms |
3448 KB |
Output is correct |
17 |
Correct |
176 ms |
4600 KB |
Output is correct |
18 |
Correct |
43 ms |
4472 KB |
Output is correct |
19 |
Correct |
178 ms |
4576 KB |
Output is correct |
20 |
Correct |
108 ms |
4472 KB |
Output is correct |
21 |
Correct |
278 ms |
4600 KB |
Output is correct |
22 |
Correct |
413 ms |
4472 KB |
Output is correct |
23 |
Correct |
448 ms |
4600 KB |
Output is correct |
24 |
Correct |
259 ms |
4472 KB |
Output is correct |
25 |
Correct |
73 ms |
4472 KB |
Output is correct |
26 |
Correct |
213 ms |
4600 KB |
Output is correct |
27 |
Correct |
133 ms |
4600 KB |
Output is correct |
28 |
Correct |
113 ms |
4520 KB |
Output is correct |
29 |
Correct |
272 ms |
4472 KB |
Output is correct |
30 |
Correct |
20 ms |
4728 KB |
Output is correct |
31 |
Correct |
22 ms |
4600 KB |
Output is correct |
32 |
Correct |
35 ms |
4728 KB |
Output is correct |
33 |
Correct |
5 ms |
376 KB |
Output is correct |
34 |
Correct |
5 ms |
376 KB |
Output is correct |
35 |
Correct |
6 ms |
376 KB |
Output is correct |
36 |
Correct |
1111 ms |
19276 KB |
Output is correct |
37 |
Correct |
566 ms |
22568 KB |
Output is correct |
38 |
Execution timed out |
2058 ms |
22780 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
380 KB |
Output is correct |
6 |
Correct |
5 ms |
456 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
9 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
5 ms |
376 KB |
Output is correct |
15 |
Correct |
5 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
306 ms |
3960 KB |
Output is correct |
19 |
Correct |
192 ms |
4728 KB |
Output is correct |
20 |
Correct |
482 ms |
4472 KB |
Output is correct |
21 |
Correct |
101 ms |
1656 KB |
Output is correct |
22 |
Correct |
57 ms |
4856 KB |
Output is correct |
23 |
Correct |
125 ms |
4740 KB |
Output is correct |
24 |
Correct |
57 ms |
2168 KB |
Output is correct |
25 |
Correct |
51 ms |
2168 KB |
Output is correct |
26 |
Correct |
32 ms |
4344 KB |
Output is correct |
27 |
Correct |
291 ms |
4472 KB |
Output is correct |
28 |
Correct |
84 ms |
3832 KB |
Output is correct |
29 |
Correct |
34 ms |
3832 KB |
Output is correct |
30 |
Correct |
79 ms |
3832 KB |
Output is correct |
31 |
Correct |
151 ms |
3320 KB |
Output is correct |
32 |
Correct |
65 ms |
3448 KB |
Output is correct |
33 |
Correct |
99 ms |
3448 KB |
Output is correct |
34 |
Correct |
176 ms |
4600 KB |
Output is correct |
35 |
Correct |
43 ms |
4472 KB |
Output is correct |
36 |
Correct |
178 ms |
4576 KB |
Output is correct |
37 |
Correct |
108 ms |
4472 KB |
Output is correct |
38 |
Correct |
278 ms |
4600 KB |
Output is correct |
39 |
Correct |
413 ms |
4472 KB |
Output is correct |
40 |
Correct |
448 ms |
4600 KB |
Output is correct |
41 |
Correct |
259 ms |
4472 KB |
Output is correct |
42 |
Correct |
73 ms |
4472 KB |
Output is correct |
43 |
Correct |
213 ms |
4600 KB |
Output is correct |
44 |
Correct |
133 ms |
4600 KB |
Output is correct |
45 |
Correct |
113 ms |
4520 KB |
Output is correct |
46 |
Correct |
272 ms |
4472 KB |
Output is correct |
47 |
Correct |
20 ms |
4728 KB |
Output is correct |
48 |
Correct |
22 ms |
4600 KB |
Output is correct |
49 |
Correct |
35 ms |
4728 KB |
Output is correct |
50 |
Correct |
5 ms |
376 KB |
Output is correct |
51 |
Correct |
5 ms |
376 KB |
Output is correct |
52 |
Correct |
6 ms |
376 KB |
Output is correct |
53 |
Correct |
1111 ms |
19276 KB |
Output is correct |
54 |
Correct |
566 ms |
22568 KB |
Output is correct |
55 |
Execution timed out |
2058 ms |
22780 KB |
Time limit exceeded |
56 |
Halted |
0 ms |
0 KB |
- |