#include <bits/stdc++.h>
using namespace std;
#define int long long
int getIndex(char c){
if(c == 'A') return 0;
if(c == 'C') return 1;
if(c == 'G') return 2;
return 3;
}
int opti[4][65][4101];
int n, m, K;
int cnst;
int compare(int a, int b){
int tot = 0;
for(int i = 0; i < cnst; i++){
for(int j = 0; j < 4; j++){
tot += __builtin_popcountll(opti[j][i][a] ^ opti[j][i][b]);
}
}
return tot;
}
signed main(){
cin >> n >> m >> K;
vector< string > v(n);
cnst = min((int)65, m/64+1);
for(int i = 0; i < n; i++){
cin >> v[i];
vector< vector< int > > nb(4, vector< int >(65));
for(int j = 1; j <= 65; j++){
for(int k = (j-1)*64; k < min(j*64, m); k++){
nb[getIndex(v[i][k])][j-1] ^= (1LL<<(63-k%64));
}
}
for(int k = 0; k < 4; k++){
for(int l = 0; l < m/64+1; l++){
opti[k][l][i] = nb[k][l];
}
}
}
for(int i = 0; i < n; i++){
bool verif = true;
for(int j = 0; j < n; j++){
if(j == i) continue;
if(compare(i,j) != K+K){
verif = false;
break;
}
}
if(verif){
cout << i+1 << endl;
return 0;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
6 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
12 |
Correct |
6 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
943 ms |
5112 KB |
Output is correct |
2 |
Correct |
694 ms |
5880 KB |
Output is correct |
3 |
Correct |
1515 ms |
5764 KB |
Output is correct |
4 |
Correct |
127 ms |
2040 KB |
Output is correct |
5 |
Correct |
259 ms |
5880 KB |
Output is correct |
6 |
Correct |
475 ms |
5880 KB |
Output is correct |
7 |
Correct |
206 ms |
3064 KB |
Output is correct |
8 |
Correct |
213 ms |
3064 KB |
Output is correct |
9 |
Correct |
178 ms |
5624 KB |
Output is correct |
10 |
Correct |
924 ms |
5752 KB |
Output is correct |
11 |
Correct |
316 ms |
5112 KB |
Output is correct |
12 |
Correct |
171 ms |
5112 KB |
Output is correct |
13 |
Correct |
287 ms |
4988 KB |
Output is correct |
14 |
Correct |
511 ms |
4600 KB |
Output is correct |
15 |
Correct |
253 ms |
4472 KB |
Output is correct |
16 |
Correct |
324 ms |
4728 KB |
Output is correct |
17 |
Correct |
602 ms |
5880 KB |
Output is correct |
18 |
Correct |
222 ms |
5900 KB |
Output is correct |
19 |
Correct |
616 ms |
5752 KB |
Output is correct |
20 |
Correct |
410 ms |
5752 KB |
Output is correct |
21 |
Correct |
939 ms |
5880 KB |
Output is correct |
22 |
Correct |
1314 ms |
5624 KB |
Output is correct |
23 |
Correct |
1411 ms |
5884 KB |
Output is correct |
24 |
Correct |
851 ms |
5880 KB |
Output is correct |
25 |
Correct |
250 ms |
5624 KB |
Output is correct |
26 |
Correct |
669 ms |
5752 KB |
Output is correct |
27 |
Correct |
461 ms |
5856 KB |
Output is correct |
28 |
Correct |
416 ms |
5624 KB |
Output is correct |
29 |
Correct |
892 ms |
5880 KB |
Output is correct |
30 |
Correct |
179 ms |
5880 KB |
Output is correct |
31 |
Correct |
180 ms |
5904 KB |
Output is correct |
32 |
Correct |
191 ms |
6008 KB |
Output is correct |
33 |
Correct |
5 ms |
376 KB |
Output is correct |
34 |
Correct |
5 ms |
376 KB |
Output is correct |
35 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
943 ms |
5112 KB |
Output is correct |
2 |
Correct |
694 ms |
5880 KB |
Output is correct |
3 |
Correct |
1515 ms |
5764 KB |
Output is correct |
4 |
Correct |
127 ms |
2040 KB |
Output is correct |
5 |
Correct |
259 ms |
5880 KB |
Output is correct |
6 |
Correct |
475 ms |
5880 KB |
Output is correct |
7 |
Correct |
206 ms |
3064 KB |
Output is correct |
8 |
Correct |
213 ms |
3064 KB |
Output is correct |
9 |
Correct |
178 ms |
5624 KB |
Output is correct |
10 |
Correct |
924 ms |
5752 KB |
Output is correct |
11 |
Correct |
316 ms |
5112 KB |
Output is correct |
12 |
Correct |
171 ms |
5112 KB |
Output is correct |
13 |
Correct |
287 ms |
4988 KB |
Output is correct |
14 |
Correct |
511 ms |
4600 KB |
Output is correct |
15 |
Correct |
253 ms |
4472 KB |
Output is correct |
16 |
Correct |
324 ms |
4728 KB |
Output is correct |
17 |
Correct |
602 ms |
5880 KB |
Output is correct |
18 |
Correct |
222 ms |
5900 KB |
Output is correct |
19 |
Correct |
616 ms |
5752 KB |
Output is correct |
20 |
Correct |
410 ms |
5752 KB |
Output is correct |
21 |
Correct |
939 ms |
5880 KB |
Output is correct |
22 |
Correct |
1314 ms |
5624 KB |
Output is correct |
23 |
Correct |
1411 ms |
5884 KB |
Output is correct |
24 |
Correct |
851 ms |
5880 KB |
Output is correct |
25 |
Correct |
250 ms |
5624 KB |
Output is correct |
26 |
Correct |
669 ms |
5752 KB |
Output is correct |
27 |
Correct |
461 ms |
5856 KB |
Output is correct |
28 |
Correct |
416 ms |
5624 KB |
Output is correct |
29 |
Correct |
892 ms |
5880 KB |
Output is correct |
30 |
Correct |
179 ms |
5880 KB |
Output is correct |
31 |
Correct |
180 ms |
5904 KB |
Output is correct |
32 |
Correct |
191 ms |
6008 KB |
Output is correct |
33 |
Correct |
5 ms |
376 KB |
Output is correct |
34 |
Correct |
5 ms |
376 KB |
Output is correct |
35 |
Correct |
5 ms |
376 KB |
Output is correct |
36 |
Execution timed out |
2090 ms |
35704 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
6 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
12 |
Correct |
6 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 |
943 ms |
5112 KB |
Output is correct |
19 |
Correct |
694 ms |
5880 KB |
Output is correct |
20 |
Correct |
1515 ms |
5764 KB |
Output is correct |
21 |
Correct |
127 ms |
2040 KB |
Output is correct |
22 |
Correct |
259 ms |
5880 KB |
Output is correct |
23 |
Correct |
475 ms |
5880 KB |
Output is correct |
24 |
Correct |
206 ms |
3064 KB |
Output is correct |
25 |
Correct |
213 ms |
3064 KB |
Output is correct |
26 |
Correct |
178 ms |
5624 KB |
Output is correct |
27 |
Correct |
924 ms |
5752 KB |
Output is correct |
28 |
Correct |
316 ms |
5112 KB |
Output is correct |
29 |
Correct |
171 ms |
5112 KB |
Output is correct |
30 |
Correct |
287 ms |
4988 KB |
Output is correct |
31 |
Correct |
511 ms |
4600 KB |
Output is correct |
32 |
Correct |
253 ms |
4472 KB |
Output is correct |
33 |
Correct |
324 ms |
4728 KB |
Output is correct |
34 |
Correct |
602 ms |
5880 KB |
Output is correct |
35 |
Correct |
222 ms |
5900 KB |
Output is correct |
36 |
Correct |
616 ms |
5752 KB |
Output is correct |
37 |
Correct |
410 ms |
5752 KB |
Output is correct |
38 |
Correct |
939 ms |
5880 KB |
Output is correct |
39 |
Correct |
1314 ms |
5624 KB |
Output is correct |
40 |
Correct |
1411 ms |
5884 KB |
Output is correct |
41 |
Correct |
851 ms |
5880 KB |
Output is correct |
42 |
Correct |
250 ms |
5624 KB |
Output is correct |
43 |
Correct |
669 ms |
5752 KB |
Output is correct |
44 |
Correct |
461 ms |
5856 KB |
Output is correct |
45 |
Correct |
416 ms |
5624 KB |
Output is correct |
46 |
Correct |
892 ms |
5880 KB |
Output is correct |
47 |
Correct |
179 ms |
5880 KB |
Output is correct |
48 |
Correct |
180 ms |
5904 KB |
Output is correct |
49 |
Correct |
191 ms |
6008 KB |
Output is correct |
50 |
Correct |
5 ms |
376 KB |
Output is correct |
51 |
Correct |
5 ms |
376 KB |
Output is correct |
52 |
Correct |
5 ms |
376 KB |
Output is correct |
53 |
Execution timed out |
2090 ms |
35704 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |