Submission #123613

# Submission time Handle Problem Language Result Execution time Memory
123613 2019-07-01T18:58:08 Z MoNsTeR_CuBe Genetics (BOI18_genetics) C++17
46 / 100
2000 ms 35952 KB
#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;
}

vector< vector< vector< int > > > opti(4, vector< vector< int > > (65, vector< int >(4101)));

int n, m, K;

int compare(int a, int b){
	int tot = 0;
	for(int i = 0; i < min((int)65, m/64+1); i++){
		for(int j = 0; j < 4; j++){
			tot += __builtin_popcountll(opti[j][i][a] ^ opti[j][i][b]);
		}
	}
	return tot/2;
}

signed main(){	
	cin >> n >> m >> K;
	
	vector< string > v(n);
	
	
	
	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++){
		cout << "NUMBER " << i << endl;
		for(int j = 0; j < 4; j++){
			cout << opti[j][0][i] << endl;
		}
	}*/

	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){
				verif = false;
				break;
			}
		}
		if(verif){
			cout << i+1 << endl;
			return 0;
		}
	}
	
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 10744 KB Output is correct
2 Correct 12 ms 10744 KB Output is correct
3 Correct 12 ms 10744 KB Output is correct
4 Correct 12 ms 10744 KB Output is correct
5 Correct 12 ms 10744 KB Output is correct
6 Correct 12 ms 10744 KB Output is correct
7 Correct 13 ms 10744 KB Output is correct
8 Correct 11 ms 10744 KB Output is correct
9 Correct 12 ms 10744 KB Output is correct
10 Correct 12 ms 10744 KB Output is correct
11 Correct 12 ms 10744 KB Output is correct
12 Correct 12 ms 10744 KB Output is correct
13 Correct 13 ms 10748 KB Output is correct
14 Correct 13 ms 10744 KB Output is correct
15 Correct 13 ms 10744 KB Output is correct
16 Correct 11 ms 10744 KB Output is correct
17 Correct 14 ms 10744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1147 ms 11744 KB Output is correct
2 Correct 814 ms 12408 KB Output is correct
3 Correct 1817 ms 12280 KB Output is correct
4 Correct 157 ms 10872 KB Output is correct
5 Correct 283 ms 12408 KB Output is correct
6 Correct 523 ms 12408 KB Output is correct
7 Correct 249 ms 11128 KB Output is correct
8 Correct 217 ms 11000 KB Output is correct
9 Correct 186 ms 12152 KB Output is correct
10 Correct 1099 ms 12280 KB Output is correct
11 Correct 377 ms 11896 KB Output is correct
12 Correct 184 ms 11768 KB Output is correct
13 Correct 318 ms 11896 KB Output is correct
14 Correct 576 ms 11512 KB Output is correct
15 Correct 279 ms 11384 KB Output is correct
16 Correct 351 ms 11768 KB Output is correct
17 Correct 709 ms 12280 KB Output is correct
18 Correct 233 ms 12152 KB Output is correct
19 Correct 694 ms 12152 KB Output is correct
20 Correct 468 ms 12152 KB Output is correct
21 Correct 1071 ms 12280 KB Output is correct
22 Correct 1581 ms 12280 KB Output is correct
23 Correct 1674 ms 12280 KB Output is correct
24 Correct 1014 ms 12280 KB Output is correct
25 Correct 266 ms 12156 KB Output is correct
26 Correct 789 ms 12368 KB Output is correct
27 Correct 538 ms 12280 KB Output is correct
28 Correct 453 ms 12152 KB Output is correct
29 Correct 1025 ms 12280 KB Output is correct
30 Correct 210 ms 12408 KB Output is correct
31 Correct 187 ms 12280 KB Output is correct
32 Correct 201 ms 12280 KB Output is correct
33 Correct 12 ms 10744 KB Output is correct
34 Correct 12 ms 10748 KB Output is correct
35 Correct 12 ms 10744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1147 ms 11744 KB Output is correct
2 Correct 814 ms 12408 KB Output is correct
3 Correct 1817 ms 12280 KB Output is correct
4 Correct 157 ms 10872 KB Output is correct
5 Correct 283 ms 12408 KB Output is correct
6 Correct 523 ms 12408 KB Output is correct
7 Correct 249 ms 11128 KB Output is correct
8 Correct 217 ms 11000 KB Output is correct
9 Correct 186 ms 12152 KB Output is correct
10 Correct 1099 ms 12280 KB Output is correct
11 Correct 377 ms 11896 KB Output is correct
12 Correct 184 ms 11768 KB Output is correct
13 Correct 318 ms 11896 KB Output is correct
14 Correct 576 ms 11512 KB Output is correct
15 Correct 279 ms 11384 KB Output is correct
16 Correct 351 ms 11768 KB Output is correct
17 Correct 709 ms 12280 KB Output is correct
18 Correct 233 ms 12152 KB Output is correct
19 Correct 694 ms 12152 KB Output is correct
20 Correct 468 ms 12152 KB Output is correct
21 Correct 1071 ms 12280 KB Output is correct
22 Correct 1581 ms 12280 KB Output is correct
23 Correct 1674 ms 12280 KB Output is correct
24 Correct 1014 ms 12280 KB Output is correct
25 Correct 266 ms 12156 KB Output is correct
26 Correct 789 ms 12368 KB Output is correct
27 Correct 538 ms 12280 KB Output is correct
28 Correct 453 ms 12152 KB Output is correct
29 Correct 1025 ms 12280 KB Output is correct
30 Correct 210 ms 12408 KB Output is correct
31 Correct 187 ms 12280 KB Output is correct
32 Correct 201 ms 12280 KB Output is correct
33 Correct 12 ms 10744 KB Output is correct
34 Correct 12 ms 10748 KB Output is correct
35 Correct 12 ms 10744 KB Output is correct
36 Execution timed out 2083 ms 35952 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 10744 KB Output is correct
2 Correct 12 ms 10744 KB Output is correct
3 Correct 12 ms 10744 KB Output is correct
4 Correct 12 ms 10744 KB Output is correct
5 Correct 12 ms 10744 KB Output is correct
6 Correct 12 ms 10744 KB Output is correct
7 Correct 13 ms 10744 KB Output is correct
8 Correct 11 ms 10744 KB Output is correct
9 Correct 12 ms 10744 KB Output is correct
10 Correct 12 ms 10744 KB Output is correct
11 Correct 12 ms 10744 KB Output is correct
12 Correct 12 ms 10744 KB Output is correct
13 Correct 13 ms 10748 KB Output is correct
14 Correct 13 ms 10744 KB Output is correct
15 Correct 13 ms 10744 KB Output is correct
16 Correct 11 ms 10744 KB Output is correct
17 Correct 14 ms 10744 KB Output is correct
18 Correct 1147 ms 11744 KB Output is correct
19 Correct 814 ms 12408 KB Output is correct
20 Correct 1817 ms 12280 KB Output is correct
21 Correct 157 ms 10872 KB Output is correct
22 Correct 283 ms 12408 KB Output is correct
23 Correct 523 ms 12408 KB Output is correct
24 Correct 249 ms 11128 KB Output is correct
25 Correct 217 ms 11000 KB Output is correct
26 Correct 186 ms 12152 KB Output is correct
27 Correct 1099 ms 12280 KB Output is correct
28 Correct 377 ms 11896 KB Output is correct
29 Correct 184 ms 11768 KB Output is correct
30 Correct 318 ms 11896 KB Output is correct
31 Correct 576 ms 11512 KB Output is correct
32 Correct 279 ms 11384 KB Output is correct
33 Correct 351 ms 11768 KB Output is correct
34 Correct 709 ms 12280 KB Output is correct
35 Correct 233 ms 12152 KB Output is correct
36 Correct 694 ms 12152 KB Output is correct
37 Correct 468 ms 12152 KB Output is correct
38 Correct 1071 ms 12280 KB Output is correct
39 Correct 1581 ms 12280 KB Output is correct
40 Correct 1674 ms 12280 KB Output is correct
41 Correct 1014 ms 12280 KB Output is correct
42 Correct 266 ms 12156 KB Output is correct
43 Correct 789 ms 12368 KB Output is correct
44 Correct 538 ms 12280 KB Output is correct
45 Correct 453 ms 12152 KB Output is correct
46 Correct 1025 ms 12280 KB Output is correct
47 Correct 210 ms 12408 KB Output is correct
48 Correct 187 ms 12280 KB Output is correct
49 Correct 201 ms 12280 KB Output is correct
50 Correct 12 ms 10744 KB Output is correct
51 Correct 12 ms 10748 KB Output is correct
52 Correct 12 ms 10744 KB Output is correct
53 Execution timed out 2083 ms 35952 KB Time limit exceeded
54 Halted 0 ms 0 KB -