# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130082 | 2019-07-13T20:55:14 Z | TadijaSebez | Genetics (BOI18_genetics) | C++11 | 1080 ms | 84476 KB |
#include <stdio.h> #include <stdlib.h> #include <ctime> const int N=4115; int my[N],sz[2],cnt[2][4][N]; char s[N][N]; int val[N][N]; bool ok[N]; int oks; void Try(int n, int m, int k) { int i,j; for(j=1;j<=m;j++) for(i=0;i<4;i++) cnt[0][i][j]=cnt[1][i][j]=0; sz[0]=sz[1]=0; for(i=1;i<=n;i++) { my[i]=rand()&1; sz[my[i]]++; for(j=1;j<=m;j++) cnt[my[i]][val[i][j]][j]++; } for(i=1;i<=n;i++) { if(ok[i]) { int po[2]; po[0]=po[1]=0; for(j=1;j<=m;j++) { po[0]+=sz[0]-cnt[0][val[i][j]][j]; po[1]+=sz[1]-cnt[1][val[i][j]][j]; } sz[my[i]]--; if(po[0]!=sz[0]*k) ok[i]=0,oks--; else if(po[1]!=sz[1]*k) ok[i]=0,oks--; sz[my[i]]++; } } } int main() { srand(time(0)); int n,m,k,i,j; scanf("%i %i %i",&n,&m,&k); for(i=1;i<=n;i++) scanf("%s",s[i]+1),ok[i]=1; for(i=1;i<=n;i++) for(j=1;j<=m;j++) { if(s[i][j]=='A') val[i][j]=0; if(s[i][j]=='C') val[i][j]=1; if(s[i][j]=='G') val[i][j]=2; if(s[i][j]=='T') val[i][j]=3; } oks=n; while(oks>1) Try(n,m,k); int ans=0; for(i=1;i<=n;i++) if(ok[i]) ans=i; printf("%i\n",ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1016 KB | Output is correct |
2 | Correct | 5 ms | 1144 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 888 KB | Output is correct |
5 | Correct | 5 ms | 1144 KB | Output is correct |
6 | Correct | 6 ms | 1144 KB | Output is correct |
7 | Correct | 5 ms | 764 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 760 KB | Output is correct |
10 | Correct | 5 ms | 1144 KB | Output is correct |
11 | Correct | 5 ms | 1016 KB | Output is correct |
12 | Correct | 5 ms | 1144 KB | Output is correct |
13 | Correct | 5 ms | 1144 KB | Output is correct |
14 | Correct | 5 ms | 1144 KB | Output is correct |
15 | Correct | 5 ms | 1148 KB | Output is correct |
16 | Correct | 5 ms | 1144 KB | Output is correct |
17 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 22776 KB | Output is correct |
2 | Correct | 57 ms | 27512 KB | Output is correct |
3 | Correct | 72 ms | 26488 KB | Output is correct |
4 | Correct | 22 ms | 12152 KB | Output is correct |
5 | Correct | 66 ms | 27512 KB | Output is correct |
6 | Correct | 70 ms | 27512 KB | Output is correct |
7 | Correct | 32 ms | 12024 KB | Output is correct |
8 | Correct | 31 ms | 12024 KB | Output is correct |
9 | Correct | 104 ms | 25976 KB | Output is correct |
10 | Correct | 117 ms | 25980 KB | Output is correct |
11 | Correct | 74 ms | 22904 KB | Output is correct |
12 | Correct | 101 ms | 22904 KB | Output is correct |
13 | Correct | 118 ms | 22908 KB | Output is correct |
14 | Correct | 79 ms | 19576 KB | Output is correct |
15 | Correct | 123 ms | 19832 KB | Output is correct |
16 | Correct | 53 ms | 21112 KB | Output is correct |
17 | Correct | 69 ms | 26616 KB | Output is correct |
18 | Correct | 68 ms | 26232 KB | Output is correct |
19 | Correct | 68 ms | 26488 KB | Output is correct |
20 | Correct | 66 ms | 25980 KB | Output is correct |
21 | Correct | 68 ms | 26360 KB | Output is correct |
22 | Correct | 67 ms | 26104 KB | Output is correct |
23 | Correct | 68 ms | 26232 KB | Output is correct |
24 | Correct | 67 ms | 26360 KB | Output is correct |
25 | Correct | 67 ms | 26104 KB | Output is correct |
26 | Correct | 68 ms | 26232 KB | Output is correct |
27 | Correct | 68 ms | 26104 KB | Output is correct |
28 | Correct | 69 ms | 26232 KB | Output is correct |
29 | Correct | 70 ms | 26232 KB | Output is correct |
30 | Correct | 57 ms | 27512 KB | Output is correct |
31 | Correct | 59 ms | 27512 KB | Output is correct |
32 | Correct | 72 ms | 27512 KB | Output is correct |
33 | Correct | 6 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 1144 KB | Output is correct |
35 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 101 ms | 22776 KB | Output is correct |
2 | Correct | 57 ms | 27512 KB | Output is correct |
3 | Correct | 72 ms | 26488 KB | Output is correct |
4 | Correct | 22 ms | 12152 KB | Output is correct |
5 | Correct | 66 ms | 27512 KB | Output is correct |
6 | Correct | 70 ms | 27512 KB | Output is correct |
7 | Correct | 32 ms | 12024 KB | Output is correct |
8 | Correct | 31 ms | 12024 KB | Output is correct |
9 | Correct | 104 ms | 25976 KB | Output is correct |
10 | Correct | 117 ms | 25980 KB | Output is correct |
11 | Correct | 74 ms | 22904 KB | Output is correct |
12 | Correct | 101 ms | 22904 KB | Output is correct |
13 | Correct | 118 ms | 22908 KB | Output is correct |
14 | Correct | 79 ms | 19576 KB | Output is correct |
15 | Correct | 123 ms | 19832 KB | Output is correct |
16 | Correct | 53 ms | 21112 KB | Output is correct |
17 | Correct | 69 ms | 26616 KB | Output is correct |
18 | Correct | 68 ms | 26232 KB | Output is correct |
19 | Correct | 68 ms | 26488 KB | Output is correct |
20 | Correct | 66 ms | 25980 KB | Output is correct |
21 | Correct | 68 ms | 26360 KB | Output is correct |
22 | Correct | 67 ms | 26104 KB | Output is correct |
23 | Correct | 68 ms | 26232 KB | Output is correct |
24 | Correct | 67 ms | 26360 KB | Output is correct |
25 | Correct | 67 ms | 26104 KB | Output is correct |
26 | Correct | 68 ms | 26232 KB | Output is correct |
27 | Correct | 68 ms | 26104 KB | Output is correct |
28 | Correct | 69 ms | 26232 KB | Output is correct |
29 | Correct | 70 ms | 26232 KB | Output is correct |
30 | Correct | 57 ms | 27512 KB | Output is correct |
31 | Correct | 59 ms | 27512 KB | Output is correct |
32 | Correct | 72 ms | 27512 KB | Output is correct |
33 | Correct | 6 ms | 376 KB | Output is correct |
34 | Correct | 5 ms | 1144 KB | Output is correct |
35 | Correct | 5 ms | 376 KB | Output is correct |
36 | Correct | 353 ms | 72692 KB | Output is correct |
37 | Correct | 250 ms | 82936 KB | Output is correct |
38 | Correct | 306 ms | 81016 KB | Output is correct |
39 | Correct | 130 ms | 52600 KB | Output is correct |
40 | Correct | 310 ms | 84472 KB | Output is correct |
41 | Correct | 161 ms | 42744 KB | Output is correct |
42 | Correct | 166 ms | 42744 KB | Output is correct |
43 | Correct | 597 ms | 71520 KB | Output is correct |
44 | Correct | 917 ms | 84472 KB | Output is correct |
45 | Correct | 656 ms | 84344 KB | Output is correct |
46 | Correct | 1080 ms | 84476 KB | Output is correct |
47 | Correct | 433 ms | 74104 KB | Output is correct |
48 | Correct | 354 ms | 73592 KB | Output is correct |
49 | Correct | 234 ms | 63224 KB | Output is correct |
50 | Correct | 238 ms | 63224 KB | Output is correct |
51 | Correct | 264 ms | 70904 KB | Output is correct |
52 | Correct | 302 ms | 82036 KB | Output is correct |
53 | Correct | 306 ms | 81912 KB | Output is correct |
54 | Correct | 250 ms | 82168 KB | Output is correct |
55 | Correct | 243 ms | 82248 KB | Output is correct |
56 | Correct | 295 ms | 81912 KB | Output is correct |
57 | Correct | 307 ms | 82040 KB | Output is correct |
58 | Correct | 304 ms | 82040 KB | Output is correct |
59 | Correct | 303 ms | 81784 KB | Output is correct |
60 | Correct | 312 ms | 82172 KB | Output is correct |
61 | Correct | 300 ms | 81656 KB | Output is correct |
62 | Correct | 306 ms | 81748 KB | Output is correct |
63 | Correct | 303 ms | 81884 KB | Output is correct |
64 | Correct | 304 ms | 81912 KB | Output is correct |
65 | Correct | 306 ms | 81784 KB | Output is correct |
66 | Correct | 304 ms | 81656 KB | Output is correct |
67 | Correct | 307 ms | 82040 KB | Output is correct |
68 | Correct | 298 ms | 81912 KB | Output is correct |
69 | Correct | 307 ms | 81544 KB | Output is correct |
70 | Correct | 307 ms | 81744 KB | Output is correct |
71 | Correct | 301 ms | 81656 KB | Output is correct |
72 | Correct | 305 ms | 82168 KB | Output is correct |
73 | Correct | 317 ms | 81528 KB | Output is correct |
74 | Correct | 4 ms | 376 KB | Output is correct |
75 | Correct | 5 ms | 1144 KB | Output is correct |
76 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1016 KB | Output is correct |
2 | Correct | 5 ms | 1144 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 888 KB | Output is correct |
5 | Correct | 5 ms | 1144 KB | Output is correct |
6 | Correct | 6 ms | 1144 KB | Output is correct |
7 | Correct | 5 ms | 764 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 760 KB | Output is correct |
10 | Correct | 5 ms | 1144 KB | Output is correct |
11 | Correct | 5 ms | 1016 KB | Output is correct |
12 | Correct | 5 ms | 1144 KB | Output is correct |
13 | Correct | 5 ms | 1144 KB | Output is correct |
14 | Correct | 5 ms | 1144 KB | Output is correct |
15 | Correct | 5 ms | 1148 KB | Output is correct |
16 | Correct | 5 ms | 1144 KB | Output is correct |
17 | Correct | 4 ms | 376 KB | Output is correct |
18 | Correct | 101 ms | 22776 KB | Output is correct |
19 | Correct | 57 ms | 27512 KB | Output is correct |
20 | Correct | 72 ms | 26488 KB | Output is correct |
21 | Correct | 22 ms | 12152 KB | Output is correct |
22 | Correct | 66 ms | 27512 KB | Output is correct |
23 | Correct | 70 ms | 27512 KB | Output is correct |
24 | Correct | 32 ms | 12024 KB | Output is correct |
25 | Correct | 31 ms | 12024 KB | Output is correct |
26 | Correct | 104 ms | 25976 KB | Output is correct |
27 | Correct | 117 ms | 25980 KB | Output is correct |
28 | Correct | 74 ms | 22904 KB | Output is correct |
29 | Correct | 101 ms | 22904 KB | Output is correct |
30 | Correct | 118 ms | 22908 KB | Output is correct |
31 | Correct | 79 ms | 19576 KB | Output is correct |
32 | Correct | 123 ms | 19832 KB | Output is correct |
33 | Correct | 53 ms | 21112 KB | Output is correct |
34 | Correct | 69 ms | 26616 KB | Output is correct |
35 | Correct | 68 ms | 26232 KB | Output is correct |
36 | Correct | 68 ms | 26488 KB | Output is correct |
37 | Correct | 66 ms | 25980 KB | Output is correct |
38 | Correct | 68 ms | 26360 KB | Output is correct |
39 | Correct | 67 ms | 26104 KB | Output is correct |
40 | Correct | 68 ms | 26232 KB | Output is correct |
41 | Correct | 67 ms | 26360 KB | Output is correct |
42 | Correct | 67 ms | 26104 KB | Output is correct |
43 | Correct | 68 ms | 26232 KB | Output is correct |
44 | Correct | 68 ms | 26104 KB | Output is correct |
45 | Correct | 69 ms | 26232 KB | Output is correct |
46 | Correct | 70 ms | 26232 KB | Output is correct |
47 | Correct | 57 ms | 27512 KB | Output is correct |
48 | Correct | 59 ms | 27512 KB | Output is correct |
49 | Correct | 72 ms | 27512 KB | Output is correct |
50 | Correct | 6 ms | 376 KB | Output is correct |
51 | Correct | 5 ms | 1144 KB | Output is correct |
52 | Correct | 5 ms | 376 KB | Output is correct |
53 | Correct | 353 ms | 72692 KB | Output is correct |
54 | Correct | 250 ms | 82936 KB | Output is correct |
55 | Correct | 306 ms | 81016 KB | Output is correct |
56 | Correct | 130 ms | 52600 KB | Output is correct |
57 | Correct | 310 ms | 84472 KB | Output is correct |
58 | Correct | 161 ms | 42744 KB | Output is correct |
59 | Correct | 166 ms | 42744 KB | Output is correct |
60 | Correct | 597 ms | 71520 KB | Output is correct |
61 | Correct | 917 ms | 84472 KB | Output is correct |
62 | Correct | 656 ms | 84344 KB | Output is correct |
63 | Correct | 1080 ms | 84476 KB | Output is correct |
64 | Correct | 433 ms | 74104 KB | Output is correct |
65 | Correct | 354 ms | 73592 KB | Output is correct |
66 | Correct | 234 ms | 63224 KB | Output is correct |
67 | Correct | 238 ms | 63224 KB | Output is correct |
68 | Correct | 264 ms | 70904 KB | Output is correct |
69 | Correct | 302 ms | 82036 KB | Output is correct |
70 | Correct | 306 ms | 81912 KB | Output is correct |
71 | Correct | 250 ms | 82168 KB | Output is correct |
72 | Correct | 243 ms | 82248 KB | Output is correct |
73 | Correct | 295 ms | 81912 KB | Output is correct |
74 | Correct | 307 ms | 82040 KB | Output is correct |
75 | Correct | 304 ms | 82040 KB | Output is correct |
76 | Correct | 303 ms | 81784 KB | Output is correct |
77 | Correct | 312 ms | 82172 KB | Output is correct |
78 | Correct | 300 ms | 81656 KB | Output is correct |
79 | Correct | 306 ms | 81748 KB | Output is correct |
80 | Correct | 303 ms | 81884 KB | Output is correct |
81 | Correct | 304 ms | 81912 KB | Output is correct |
82 | Correct | 306 ms | 81784 KB | Output is correct |
83 | Correct | 304 ms | 81656 KB | Output is correct |
84 | Correct | 307 ms | 82040 KB | Output is correct |
85 | Correct | 298 ms | 81912 KB | Output is correct |
86 | Correct | 307 ms | 81544 KB | Output is correct |
87 | Correct | 307 ms | 81744 KB | Output is correct |
88 | Correct | 301 ms | 81656 KB | Output is correct |
89 | Correct | 305 ms | 82168 KB | Output is correct |
90 | Correct | 317 ms | 81528 KB | Output is correct |
91 | Correct | 4 ms | 376 KB | Output is correct |
92 | Correct | 5 ms | 1144 KB | Output is correct |
93 | Correct | 5 ms | 376 KB | Output is correct |
94 | Correct | 427 ms | 79352 KB | Output is correct |
95 | Correct | 301 ms | 83704 KB | Output is correct |
96 | Correct | 354 ms | 82168 KB | Output is correct |
97 | Correct | 197 ms | 45176 KB | Output is correct |
98 | Correct | 136 ms | 52216 KB | Output is correct |
99 | Correct | 311 ms | 83656 KB | Output is correct |
100 | Correct | 184 ms | 42488 KB | Output is correct |
101 | Correct | 180 ms | 42360 KB | Output is correct |
102 | Correct | 514 ms | 70904 KB | Output is correct |
103 | Correct | 821 ms | 83832 KB | Output is correct |
104 | Correct | 879 ms | 83576 KB | Output is correct |
105 | Correct | 786 ms | 83704 KB | Output is correct |
106 | Correct | 427 ms | 79608 KB | Output is correct |
107 | Correct | 345 ms | 73464 KB | Output is correct |
108 | Correct | 371 ms | 63352 KB | Output is correct |
109 | Correct | 387 ms | 72440 KB | Output is correct |
110 | Correct | 301 ms | 71160 KB | Output is correct |
111 | Correct | 340 ms | 83832 KB | Output is correct |
112 | Correct | 357 ms | 83064 KB | Output is correct |
113 | Correct | 279 ms | 81912 KB | Output is correct |
114 | Correct | 249 ms | 81952 KB | Output is correct |
115 | Correct | 341 ms | 81896 KB | Output is correct |
116 | Correct | 357 ms | 82680 KB | Output is correct |
117 | Correct | 366 ms | 82988 KB | Output is correct |
118 | Correct | 358 ms | 82808 KB | Output is correct |
119 | Correct | 355 ms | 82552 KB | Output is correct |
120 | Correct | 363 ms | 82936 KB | Output is correct |
121 | Correct | 351 ms | 73508 KB | Output is correct |
122 | Correct | 251 ms | 84088 KB | Output is correct |
123 | Correct | 300 ms | 82040 KB | Output is correct |
124 | Correct | 5 ms | 376 KB | Output is correct |
125 | Correct | 5 ms | 1144 KB | Output is correct |
126 | Correct | 5 ms | 376 KB | Output is correct |