Submission #123620

# Submission time Handle Problem Language Result Execution time Memory
123620 2019-07-01T19:08:00 Z MoNsTeR_CuBe Genetics (BOI18_genetics) C++17
19 / 100
2000 ms 31736 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;
}

int opti[2][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 < 2; 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(2, 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 < 2; 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;
		}
	}
	
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 528 ms 4088 KB Output is correct
2 Correct 413 ms 4984 KB Output is correct
3 Correct 812 ms 4796 KB Output is correct
4 Correct 82 ms 1784 KB Output is correct
5 Correct 219 ms 4856 KB Output is correct
6 Correct 314 ms 4856 KB Output is correct
7 Correct 143 ms 2424 KB Output is correct
8 Correct 132 ms 2400 KB Output is correct
9 Correct 180 ms 4600 KB Output is correct
10 Correct 535 ms 4728 KB Output is correct
11 Correct 224 ms 4088 KB Output is correct
12 Correct 172 ms 4216 KB Output is correct
13 Correct 225 ms 4088 KB Output is correct
14 Correct 299 ms 3704 KB Output is correct
15 Correct 184 ms 3704 KB Output is correct
16 Correct 203 ms 3964 KB Output is correct
17 Correct 375 ms 4600 KB Output is correct
18 Correct 198 ms 4688 KB Output is correct
19 Correct 375 ms 4728 KB Output is correct
20 Correct 288 ms 4728 KB Output is correct
21 Correct 519 ms 4728 KB Output is correct
22 Correct 684 ms 4728 KB Output is correct
23 Correct 723 ms 4732 KB Output is correct
24 Correct 483 ms 4728 KB Output is correct
25 Correct 212 ms 4600 KB Output is correct
26 Correct 403 ms 4600 KB Output is correct
27 Correct 310 ms 4728 KB Output is correct
28 Correct 280 ms 4600 KB Output is correct
29 Correct 492 ms 4728 KB Output is correct
30 Correct 177 ms 4856 KB Output is correct
31 Correct 176 ms 4856 KB Output is correct
32 Correct 191 ms 4860 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
# Verdict Execution time Memory Grader output
1 Correct 528 ms 4088 KB Output is correct
2 Correct 413 ms 4984 KB Output is correct
3 Correct 812 ms 4796 KB Output is correct
4 Correct 82 ms 1784 KB Output is correct
5 Correct 219 ms 4856 KB Output is correct
6 Correct 314 ms 4856 KB Output is correct
7 Correct 143 ms 2424 KB Output is correct
8 Correct 132 ms 2400 KB Output is correct
9 Correct 180 ms 4600 KB Output is correct
10 Correct 535 ms 4728 KB Output is correct
11 Correct 224 ms 4088 KB Output is correct
12 Correct 172 ms 4216 KB Output is correct
13 Correct 225 ms 4088 KB Output is correct
14 Correct 299 ms 3704 KB Output is correct
15 Correct 184 ms 3704 KB Output is correct
16 Correct 203 ms 3964 KB Output is correct
17 Correct 375 ms 4600 KB Output is correct
18 Correct 198 ms 4688 KB Output is correct
19 Correct 375 ms 4728 KB Output is correct
20 Correct 288 ms 4728 KB Output is correct
21 Correct 519 ms 4728 KB Output is correct
22 Correct 684 ms 4728 KB Output is correct
23 Correct 723 ms 4732 KB Output is correct
24 Correct 483 ms 4728 KB Output is correct
25 Correct 212 ms 4600 KB Output is correct
26 Correct 403 ms 4600 KB Output is correct
27 Correct 310 ms 4728 KB Output is correct
28 Correct 280 ms 4600 KB Output is correct
29 Correct 492 ms 4728 KB Output is correct
30 Correct 177 ms 4856 KB Output is correct
31 Correct 176 ms 4856 KB Output is correct
32 Correct 191 ms 4860 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 2083 ms 31736 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -