#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 < 65; 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<<(k));
}
}
for(int k = 0; k < 4; k++){
for(int l = 0; l < cnst; 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 |
6 ms |
376 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Correct |
10 ms |
376 KB |
Output is correct |
6 |
Correct |
10 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
380 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
9 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
376 KB |
Output is correct |
11 |
Correct |
6 ms |
376 KB |
Output is correct |
12 |
Correct |
17 ms |
504 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
376 KB |
Output is correct |
15 |
Correct |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2084 ms |
4984 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2084 ms |
4984 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Output is correct |
2 |
Correct |
6 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
10 ms |
376 KB |
Output is correct |
5 |
Correct |
10 ms |
376 KB |
Output is correct |
6 |
Correct |
10 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
380 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
9 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
376 KB |
Output is correct |
11 |
Correct |
6 ms |
376 KB |
Output is correct |
12 |
Correct |
17 ms |
504 KB |
Output is correct |
13 |
Correct |
6 ms |
376 KB |
Output is correct |
14 |
Correct |
6 ms |
376 KB |
Output is correct |
15 |
Correct |
6 ms |
376 KB |
Output is correct |
16 |
Correct |
5 ms |
376 KB |
Output is correct |
17 |
Correct |
6 ms |
376 KB |
Output is correct |
18 |
Execution timed out |
2084 ms |
4984 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |