#include <bits/stdc++.h>
using namespace std;
int uc[4][4107],k,m;
long long arr[4107][4107],ars[4107][1000];
bool c[4107],ps;
bool check(int a,int b)
{
int x=0;
for(int i=0;i<=(ps?(m-1)/16:(m-1)/64);i++) x+=__builtin_popcountll(ars[a][i] xor ars[b][i]);
if(ps) x/=2;
if(x==k) return true;
return false;
}
int main()
{
ios::sync_with_stdio(false);
int n;
cin>>n>>m>>k;
string s;
for(int i=0;i<n;i++)
{
cin>>s;
for(int j=0;j<m;j++)
{
if(s[j]=='A') arr[i][j]=0;
if(s[j]=='C') arr[i][j]=1;
if(s[j]=='G') arr[i][j]=2;
if(s[j]=='T') arr[i][j]=3;
if(arr[i][j]>1) ps=true;
uc[arr[i][j]][j]++;
}
}
if(!ps) for(int i=0;i<n;i++) for(int j=0;j<m;j++) ars[i][j/64]+=(arr[i][j]<<(j%64));
else for(int i=0;i<n;i++) for(int j=0;j<m;j++) ars[i][j/16]+=(1LL<<(arr[i][j]+(j%16)*4));
int x=0,y=1;
mt19937 rng(11122000);
/*for(int ttt=0;ttt<400000;ttt++)
{
x=uniform_int_distribution<int>(0, n-1)(rng),y=uniform_int_distribution<int>(0,n-1)(rng);
if(x==y) continue;
int st=0;
if(!check(x,y)) {c[x]=c[y]=true;};
}*/
for(int i=0;i<n;i++) if(!c[i])
{
int skor=0;
bool propo=false;
for(int j=0;j<40;j++)
{
y=uniform_int_distribution<int>(0, n-1)(rng);
if(i==y) continue;
if(!check(i,y)) {c[i]=c[y]=true;}
}
if(c[i]) continue;
for(int j=0;j<m;j++) skor+=(n-uc[arr[i][j]][j]);
if(skor!=(n-1)*k) continue;
for(int j=0;j<n;j++) if(i!=j) if(!check(i,j)) {propo=true; break;}
if(propo) continue;
printf("%d",i+1);
return 0;
}
}
Compilation message
genetics.cpp: In function 'int main()':
genetics.cpp:35:6: warning: unused variable 'x' [-Wunused-variable]
int x=0,y=1;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1144 KB |
Output is correct |
2 |
Correct |
5 ms |
1272 KB |
Output is correct |
3 |
Correct |
5 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
1016 KB |
Output is correct |
5 |
Correct |
5 ms |
1144 KB |
Output is correct |
6 |
Correct |
5 ms |
1144 KB |
Output is correct |
7 |
Correct |
5 ms |
760 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
888 KB |
Output is correct |
10 |
Correct |
5 ms |
1272 KB |
Output is correct |
11 |
Correct |
5 ms |
1144 KB |
Output is correct |
12 |
Correct |
5 ms |
1272 KB |
Output is correct |
13 |
Correct |
6 ms |
1272 KB |
Output is correct |
14 |
Correct |
6 ms |
1272 KB |
Output is correct |
15 |
Correct |
5 ms |
1272 KB |
Output is correct |
16 |
Correct |
5 ms |
1144 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
34080 KB |
Output is correct |
2 |
Correct |
71 ms |
41336 KB |
Output is correct |
3 |
Correct |
86 ms |
39544 KB |
Output is correct |
4 |
Correct |
26 ms |
15352 KB |
Output is correct |
5 |
Correct |
70 ms |
41336 KB |
Output is correct |
6 |
Correct |
76 ms |
41336 KB |
Output is correct |
7 |
Correct |
38 ms |
18168 KB |
Output is correct |
8 |
Correct |
35 ms |
18168 KB |
Output is correct |
9 |
Correct |
65 ms |
38648 KB |
Output is correct |
10 |
Correct |
103 ms |
38648 KB |
Output is correct |
11 |
Correct |
77 ms |
33912 KB |
Output is correct |
12 |
Correct |
58 ms |
34168 KB |
Output is correct |
13 |
Correct |
67 ms |
33912 KB |
Output is correct |
14 |
Correct |
68 ms |
29304 KB |
Output is correct |
15 |
Correct |
60 ms |
29688 KB |
Output is correct |
16 |
Correct |
55 ms |
30816 KB |
Output is correct |
17 |
Correct |
79 ms |
39552 KB |
Output is correct |
18 |
Correct |
67 ms |
39288 KB |
Output is correct |
19 |
Correct |
76 ms |
39544 KB |
Output is correct |
20 |
Correct |
70 ms |
39032 KB |
Output is correct |
21 |
Correct |
76 ms |
39544 KB |
Output is correct |
22 |
Correct |
79 ms |
39288 KB |
Output is correct |
23 |
Correct |
82 ms |
39416 KB |
Output is correct |
24 |
Correct |
82 ms |
39544 KB |
Output is correct |
25 |
Correct |
68 ms |
39160 KB |
Output is correct |
26 |
Correct |
80 ms |
39416 KB |
Output is correct |
27 |
Correct |
72 ms |
39160 KB |
Output is correct |
28 |
Correct |
70 ms |
39160 KB |
Output is correct |
29 |
Correct |
79 ms |
39544 KB |
Output is correct |
30 |
Correct |
57 ms |
41312 KB |
Output is correct |
31 |
Correct |
57 ms |
41464 KB |
Output is correct |
32 |
Correct |
69 ms |
41336 KB |
Output is correct |
33 |
Correct |
5 ms |
568 KB |
Output is correct |
34 |
Correct |
5 ms |
1272 KB |
Output is correct |
35 |
Correct |
5 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
112 ms |
34080 KB |
Output is correct |
2 |
Correct |
71 ms |
41336 KB |
Output is correct |
3 |
Correct |
86 ms |
39544 KB |
Output is correct |
4 |
Correct |
26 ms |
15352 KB |
Output is correct |
5 |
Correct |
70 ms |
41336 KB |
Output is correct |
6 |
Correct |
76 ms |
41336 KB |
Output is correct |
7 |
Correct |
38 ms |
18168 KB |
Output is correct |
8 |
Correct |
35 ms |
18168 KB |
Output is correct |
9 |
Correct |
65 ms |
38648 KB |
Output is correct |
10 |
Correct |
103 ms |
38648 KB |
Output is correct |
11 |
Correct |
77 ms |
33912 KB |
Output is correct |
12 |
Correct |
58 ms |
34168 KB |
Output is correct |
13 |
Correct |
67 ms |
33912 KB |
Output is correct |
14 |
Correct |
68 ms |
29304 KB |
Output is correct |
15 |
Correct |
60 ms |
29688 KB |
Output is correct |
16 |
Correct |
55 ms |
30816 KB |
Output is correct |
17 |
Correct |
79 ms |
39552 KB |
Output is correct |
18 |
Correct |
67 ms |
39288 KB |
Output is correct |
19 |
Correct |
76 ms |
39544 KB |
Output is correct |
20 |
Correct |
70 ms |
39032 KB |
Output is correct |
21 |
Correct |
76 ms |
39544 KB |
Output is correct |
22 |
Correct |
79 ms |
39288 KB |
Output is correct |
23 |
Correct |
82 ms |
39416 KB |
Output is correct |
24 |
Correct |
82 ms |
39544 KB |
Output is correct |
25 |
Correct |
68 ms |
39160 KB |
Output is correct |
26 |
Correct |
80 ms |
39416 KB |
Output is correct |
27 |
Correct |
72 ms |
39160 KB |
Output is correct |
28 |
Correct |
70 ms |
39160 KB |
Output is correct |
29 |
Correct |
79 ms |
39544 KB |
Output is correct |
30 |
Correct |
57 ms |
41312 KB |
Output is correct |
31 |
Correct |
57 ms |
41464 KB |
Output is correct |
32 |
Correct |
69 ms |
41336 KB |
Output is correct |
33 |
Correct |
5 ms |
568 KB |
Output is correct |
34 |
Correct |
5 ms |
1272 KB |
Output is correct |
35 |
Correct |
5 ms |
504 KB |
Output is correct |
36 |
Correct |
605 ms |
132856 KB |
Output is correct |
37 |
Correct |
282 ms |
151536 KB |
Output is correct |
38 |
Correct |
372 ms |
147964 KB |
Output is correct |
39 |
Correct |
143 ms |
76280 KB |
Output is correct |
40 |
Correct |
350 ms |
151416 KB |
Output is correct |
41 |
Correct |
178 ms |
76280 KB |
Output is correct |
42 |
Correct |
158 ms |
76280 KB |
Output is correct |
43 |
Correct |
252 ms |
124024 KB |
Output is correct |
44 |
Correct |
323 ms |
151544 KB |
Output is correct |
45 |
Correct |
412 ms |
151544 KB |
Output is correct |
46 |
Correct |
339 ms |
151544 KB |
Output is correct |
47 |
Correct |
531 ms |
132984 KB |
Output is correct |
48 |
Correct |
462 ms |
132728 KB |
Output is correct |
49 |
Correct |
258 ms |
114040 KB |
Output is correct |
50 |
Correct |
543 ms |
113912 KB |
Output is correct |
51 |
Correct |
304 ms |
128120 KB |
Output is correct |
52 |
Correct |
351 ms |
147704 KB |
Output is correct |
53 |
Correct |
358 ms |
147704 KB |
Output is correct |
54 |
Correct |
237 ms |
147832 KB |
Output is correct |
55 |
Correct |
247 ms |
147960 KB |
Output is correct |
56 |
Correct |
289 ms |
147832 KB |
Output is correct |
57 |
Correct |
370 ms |
148216 KB |
Output is correct |
58 |
Correct |
331 ms |
148144 KB |
Output is correct |
59 |
Correct |
309 ms |
147320 KB |
Output is correct |
60 |
Correct |
310 ms |
148216 KB |
Output is correct |
61 |
Correct |
314 ms |
147320 KB |
Output is correct |
62 |
Correct |
306 ms |
146796 KB |
Output is correct |
63 |
Correct |
301 ms |
147960 KB |
Output is correct |
64 |
Correct |
314 ms |
147832 KB |
Output is correct |
65 |
Correct |
369 ms |
147320 KB |
Output is correct |
66 |
Correct |
347 ms |
147448 KB |
Output is correct |
67 |
Correct |
351 ms |
148220 KB |
Output is correct |
68 |
Correct |
320 ms |
147960 KB |
Output is correct |
69 |
Correct |
300 ms |
147320 KB |
Output is correct |
70 |
Correct |
348 ms |
147832 KB |
Output is correct |
71 |
Correct |
318 ms |
147064 KB |
Output is correct |
72 |
Correct |
332 ms |
148088 KB |
Output is correct |
73 |
Correct |
341 ms |
146940 KB |
Output is correct |
74 |
Correct |
5 ms |
380 KB |
Output is correct |
75 |
Correct |
5 ms |
1272 KB |
Output is correct |
76 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1144 KB |
Output is correct |
2 |
Correct |
5 ms |
1272 KB |
Output is correct |
3 |
Correct |
5 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
1016 KB |
Output is correct |
5 |
Correct |
5 ms |
1144 KB |
Output is correct |
6 |
Correct |
5 ms |
1144 KB |
Output is correct |
7 |
Correct |
5 ms |
760 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
888 KB |
Output is correct |
10 |
Correct |
5 ms |
1272 KB |
Output is correct |
11 |
Correct |
5 ms |
1144 KB |
Output is correct |
12 |
Correct |
5 ms |
1272 KB |
Output is correct |
13 |
Correct |
6 ms |
1272 KB |
Output is correct |
14 |
Correct |
6 ms |
1272 KB |
Output is correct |
15 |
Correct |
5 ms |
1272 KB |
Output is correct |
16 |
Correct |
5 ms |
1144 KB |
Output is correct |
17 |
Correct |
5 ms |
376 KB |
Output is correct |
18 |
Correct |
112 ms |
34080 KB |
Output is correct |
19 |
Correct |
71 ms |
41336 KB |
Output is correct |
20 |
Correct |
86 ms |
39544 KB |
Output is correct |
21 |
Correct |
26 ms |
15352 KB |
Output is correct |
22 |
Correct |
70 ms |
41336 KB |
Output is correct |
23 |
Correct |
76 ms |
41336 KB |
Output is correct |
24 |
Correct |
38 ms |
18168 KB |
Output is correct |
25 |
Correct |
35 ms |
18168 KB |
Output is correct |
26 |
Correct |
65 ms |
38648 KB |
Output is correct |
27 |
Correct |
103 ms |
38648 KB |
Output is correct |
28 |
Correct |
77 ms |
33912 KB |
Output is correct |
29 |
Correct |
58 ms |
34168 KB |
Output is correct |
30 |
Correct |
67 ms |
33912 KB |
Output is correct |
31 |
Correct |
68 ms |
29304 KB |
Output is correct |
32 |
Correct |
60 ms |
29688 KB |
Output is correct |
33 |
Correct |
55 ms |
30816 KB |
Output is correct |
34 |
Correct |
79 ms |
39552 KB |
Output is correct |
35 |
Correct |
67 ms |
39288 KB |
Output is correct |
36 |
Correct |
76 ms |
39544 KB |
Output is correct |
37 |
Correct |
70 ms |
39032 KB |
Output is correct |
38 |
Correct |
76 ms |
39544 KB |
Output is correct |
39 |
Correct |
79 ms |
39288 KB |
Output is correct |
40 |
Correct |
82 ms |
39416 KB |
Output is correct |
41 |
Correct |
82 ms |
39544 KB |
Output is correct |
42 |
Correct |
68 ms |
39160 KB |
Output is correct |
43 |
Correct |
80 ms |
39416 KB |
Output is correct |
44 |
Correct |
72 ms |
39160 KB |
Output is correct |
45 |
Correct |
70 ms |
39160 KB |
Output is correct |
46 |
Correct |
79 ms |
39544 KB |
Output is correct |
47 |
Correct |
57 ms |
41312 KB |
Output is correct |
48 |
Correct |
57 ms |
41464 KB |
Output is correct |
49 |
Correct |
69 ms |
41336 KB |
Output is correct |
50 |
Correct |
5 ms |
568 KB |
Output is correct |
51 |
Correct |
5 ms |
1272 KB |
Output is correct |
52 |
Correct |
5 ms |
504 KB |
Output is correct |
53 |
Correct |
605 ms |
132856 KB |
Output is correct |
54 |
Correct |
282 ms |
151536 KB |
Output is correct |
55 |
Correct |
372 ms |
147964 KB |
Output is correct |
56 |
Correct |
143 ms |
76280 KB |
Output is correct |
57 |
Correct |
350 ms |
151416 KB |
Output is correct |
58 |
Correct |
178 ms |
76280 KB |
Output is correct |
59 |
Correct |
158 ms |
76280 KB |
Output is correct |
60 |
Correct |
252 ms |
124024 KB |
Output is correct |
61 |
Correct |
323 ms |
151544 KB |
Output is correct |
62 |
Correct |
412 ms |
151544 KB |
Output is correct |
63 |
Correct |
339 ms |
151544 KB |
Output is correct |
64 |
Correct |
531 ms |
132984 KB |
Output is correct |
65 |
Correct |
462 ms |
132728 KB |
Output is correct |
66 |
Correct |
258 ms |
114040 KB |
Output is correct |
67 |
Correct |
543 ms |
113912 KB |
Output is correct |
68 |
Correct |
304 ms |
128120 KB |
Output is correct |
69 |
Correct |
351 ms |
147704 KB |
Output is correct |
70 |
Correct |
358 ms |
147704 KB |
Output is correct |
71 |
Correct |
237 ms |
147832 KB |
Output is correct |
72 |
Correct |
247 ms |
147960 KB |
Output is correct |
73 |
Correct |
289 ms |
147832 KB |
Output is correct |
74 |
Correct |
370 ms |
148216 KB |
Output is correct |
75 |
Correct |
331 ms |
148144 KB |
Output is correct |
76 |
Correct |
309 ms |
147320 KB |
Output is correct |
77 |
Correct |
310 ms |
148216 KB |
Output is correct |
78 |
Correct |
314 ms |
147320 KB |
Output is correct |
79 |
Correct |
306 ms |
146796 KB |
Output is correct |
80 |
Correct |
301 ms |
147960 KB |
Output is correct |
81 |
Correct |
314 ms |
147832 KB |
Output is correct |
82 |
Correct |
369 ms |
147320 KB |
Output is correct |
83 |
Correct |
347 ms |
147448 KB |
Output is correct |
84 |
Correct |
351 ms |
148220 KB |
Output is correct |
85 |
Correct |
320 ms |
147960 KB |
Output is correct |
86 |
Correct |
300 ms |
147320 KB |
Output is correct |
87 |
Correct |
348 ms |
147832 KB |
Output is correct |
88 |
Correct |
318 ms |
147064 KB |
Output is correct |
89 |
Correct |
332 ms |
148088 KB |
Output is correct |
90 |
Correct |
341 ms |
146940 KB |
Output is correct |
91 |
Correct |
5 ms |
380 KB |
Output is correct |
92 |
Correct |
5 ms |
1272 KB |
Output is correct |
93 |
Correct |
5 ms |
376 KB |
Output is correct |
94 |
Correct |
386 ms |
148600 KB |
Output is correct |
95 |
Correct |
375 ms |
157184 KB |
Output is correct |
96 |
Correct |
523 ms |
154872 KB |
Output is correct |
97 |
Correct |
284 ms |
84856 KB |
Output is correct |
98 |
Correct |
174 ms |
78460 KB |
Output is correct |
99 |
Correct |
367 ms |
151160 KB |
Output is correct |
100 |
Correct |
226 ms |
79352 KB |
Output is correct |
101 |
Correct |
203 ms |
79352 KB |
Output is correct |
102 |
Correct |
280 ms |
128376 KB |
Output is correct |
103 |
Correct |
352 ms |
151288 KB |
Output is correct |
104 |
Correct |
677 ms |
157560 KB |
Output is correct |
105 |
Execution timed out |
2085 ms |
157432 KB |
Time limit exceeded |
106 |
Halted |
0 ms |
0 KB |
- |