# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59603 | 2018-07-22T17:13:33 Z | IvanC | Genetics (BOI18_genetics) | C++17 | 1345 ms | 66680 KB |
#include <bits/stdc++.h> using namespace std; typedef bitset<4101> bt; const int MAXN = 4101; bt matriz[MAXN][4],temporario; char entrada[MAXN]; int N,M,K,marcado[MAXN],jafoi[MAXN][MAXN],somatorio[MAXN][4]; knuth_b gen(1337); int func(int i){ return gen() % i; } int main(){ scanf("%d %d %d",&N,&M,&K); K = M - K; int LIM = 2; vector<int> permutacao; for(int i = 1;i<=N;i++){ permutacao.push_back(i); scanf("%s",entrada); for(int j = 0;j<M;j++){ if(entrada[j] == 'A'){ matriz[i][0].set(j); somatorio[j][0]++; } else if(entrada[j] == 'C'){ matriz[i][1].set(j); somatorio[j][1]++; } else if(entrada[j] == 'T'){ matriz[i][2].set(j); somatorio[j][2]++; LIM = 4; } else{ matriz[i][3].set(j); somatorio[j][3]++; LIM = 4; } } } random_shuffle(permutacao.begin(),permutacao.end(),func); for(int v : permutacao){ if(marcado[v]) continue; int flag = 0; int total = 0; for(int i = 0;i<M;i++){ for(int j = 0;j<4;j++){ if(matriz[v][j].test(i)){ total += somatorio[i][j]; break; } } } total -= M; if((N-1)*K != total) continue; for(int u : permutacao){ if(u == v || jafoi[u][v]) continue; jafoi[u][v] = jafoi[v][u] = 1; int qtd = 0; for(int i = 0;i<LIM;i++){ temporario = matriz[u][i] & matriz[v][i]; qtd += temporario.count(); } if(qtd != K){ marcado[u] = 1; marcado[v] = 1; flag = 1; break; } } if(!flag){ printf("%d\n",v); return 0; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 892 KB | Output is correct |
2 | Correct | 5 ms | 888 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 888 KB | Output is correct |
5 | Correct | 7 ms | 888 KB | Output is correct |
6 | Correct | 5 ms | 892 KB | Output is correct |
7 | Correct | 5 ms | 632 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 6 ms | 760 KB | Output is correct |
10 | Correct | 6 ms | 888 KB | Output is correct |
11 | Correct | 5 ms | 888 KB | Output is correct |
12 | Correct | 5 ms | 888 KB | Output is correct |
13 | Correct | 5 ms | 888 KB | Output is correct |
14 | Correct | 5 ms | 1016 KB | Output is correct |
15 | Correct | 5 ms | 1016 KB | Output is correct |
16 | Correct | 6 ms | 1016 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 15096 KB | Output is correct |
2 | Correct | 48 ms | 12028 KB | Output is correct |
3 | Correct | 50 ms | 11512 KB | Output is correct |
4 | Correct | 18 ms | 7672 KB | Output is correct |
5 | Correct | 64 ms | 12024 KB | Output is correct |
6 | Correct | 61 ms | 12024 KB | Output is correct |
7 | Correct | 30 ms | 5368 KB | Output is correct |
8 | Correct | 26 ms | 5368 KB | Output is correct |
9 | Correct | 117 ms | 20216 KB | Output is correct |
10 | Correct | 88 ms | 17656 KB | Output is correct |
11 | Correct | 57 ms | 15096 KB | Output is correct |
12 | Correct | 65 ms | 12152 KB | Output is correct |
13 | Correct | 91 ms | 13304 KB | Output is correct |
14 | Correct | 127 ms | 13176 KB | Output is correct |
15 | Correct | 83 ms | 11028 KB | Output is correct |
16 | Correct | 46 ms | 9848 KB | Output is correct |
17 | Correct | 53 ms | 11512 KB | Output is correct |
18 | Correct | 65 ms | 11512 KB | Output is correct |
19 | Correct | 67 ms | 11512 KB | Output is correct |
20 | Correct | 62 ms | 11388 KB | Output is correct |
21 | Correct | 63 ms | 11512 KB | Output is correct |
22 | Correct | 49 ms | 11512 KB | Output is correct |
23 | Correct | 59 ms | 11644 KB | Output is correct |
24 | Correct | 62 ms | 11512 KB | Output is correct |
25 | Correct | 54 ms | 11384 KB | Output is correct |
26 | Correct | 65 ms | 11512 KB | Output is correct |
27 | Correct | 54 ms | 11512 KB | Output is correct |
28 | Correct | 53 ms | 11384 KB | Output is correct |
29 | Correct | 50 ms | 11512 KB | Output is correct |
30 | Correct | 42 ms | 12024 KB | Output is correct |
31 | Correct | 44 ms | 12024 KB | Output is correct |
32 | Correct | 62 ms | 12028 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 1016 KB | Output is correct |
35 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 82 ms | 15096 KB | Output is correct |
2 | Correct | 48 ms | 12028 KB | Output is correct |
3 | Correct | 50 ms | 11512 KB | Output is correct |
4 | Correct | 18 ms | 7672 KB | Output is correct |
5 | Correct | 64 ms | 12024 KB | Output is correct |
6 | Correct | 61 ms | 12024 KB | Output is correct |
7 | Correct | 30 ms | 5368 KB | Output is correct |
8 | Correct | 26 ms | 5368 KB | Output is correct |
9 | Correct | 117 ms | 20216 KB | Output is correct |
10 | Correct | 88 ms | 17656 KB | Output is correct |
11 | Correct | 57 ms | 15096 KB | Output is correct |
12 | Correct | 65 ms | 12152 KB | Output is correct |
13 | Correct | 91 ms | 13304 KB | Output is correct |
14 | Correct | 127 ms | 13176 KB | Output is correct |
15 | Correct | 83 ms | 11028 KB | Output is correct |
16 | Correct | 46 ms | 9848 KB | Output is correct |
17 | Correct | 53 ms | 11512 KB | Output is correct |
18 | Correct | 65 ms | 11512 KB | Output is correct |
19 | Correct | 67 ms | 11512 KB | Output is correct |
20 | Correct | 62 ms | 11388 KB | Output is correct |
21 | Correct | 63 ms | 11512 KB | Output is correct |
22 | Correct | 49 ms | 11512 KB | Output is correct |
23 | Correct | 59 ms | 11644 KB | Output is correct |
24 | Correct | 62 ms | 11512 KB | Output is correct |
25 | Correct | 54 ms | 11384 KB | Output is correct |
26 | Correct | 65 ms | 11512 KB | Output is correct |
27 | Correct | 54 ms | 11512 KB | Output is correct |
28 | Correct | 53 ms | 11384 KB | Output is correct |
29 | Correct | 50 ms | 11512 KB | Output is correct |
30 | Correct | 42 ms | 12024 KB | Output is correct |
31 | Correct | 44 ms | 12024 KB | Output is correct |
32 | Correct | 62 ms | 12028 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 1016 KB | Output is correct |
35 | Correct | 5 ms | 376 KB | Output is correct |
36 | Correct | 831 ms | 52600 KB | Output is correct |
37 | Correct | 183 ms | 26232 KB | Output is correct |
38 | Correct | 255 ms | 25852 KB | Output is correct |
39 | Correct | 111 ms | 22012 KB | Output is correct |
40 | Correct | 295 ms | 26104 KB | Output is correct |
41 | Correct | 159 ms | 13748 KB | Output is correct |
42 | Correct | 150 ms | 13688 KB | Output is correct |
43 | Correct | 674 ms | 53984 KB | Output is correct |
44 | Correct | 536 ms | 59260 KB | Output is correct |
45 | Correct | 394 ms | 59512 KB | Output is correct |
46 | Correct | 471 ms | 66680 KB | Output is correct |
47 | Correct | 563 ms | 41720 KB | Output is correct |
48 | Correct | 632 ms | 59512 KB | Output is correct |
49 | Correct | 167 ms | 22392 KB | Output is correct |
50 | Correct | 744 ms | 37372 KB | Output is correct |
51 | Correct | 262 ms | 22008 KB | Output is correct |
52 | Correct | 258 ms | 25336 KB | Output is correct |
53 | Correct | 246 ms | 25320 KB | Output is correct |
54 | Correct | 229 ms | 25464 KB | Output is correct |
55 | Correct | 211 ms | 25464 KB | Output is correct |
56 | Correct | 276 ms | 25592 KB | Output is correct |
57 | Correct | 298 ms | 25592 KB | Output is correct |
58 | Correct | 219 ms | 25592 KB | Output is correct |
59 | Correct | 206 ms | 25592 KB | Output is correct |
60 | Correct | 304 ms | 25592 KB | Output is correct |
61 | Correct | 197 ms | 25340 KB | Output is correct |
62 | Correct | 293 ms | 26000 KB | Output is correct |
63 | Correct | 289 ms | 25592 KB | Output is correct |
64 | Correct | 292 ms | 25464 KB | Output is correct |
65 | Correct | 265 ms | 25464 KB | Output is correct |
66 | Correct | 214 ms | 25464 KB | Output is correct |
67 | Correct | 218 ms | 25684 KB | Output is correct |
68 | Correct | 203 ms | 25592 KB | Output is correct |
69 | Correct | 202 ms | 25464 KB | Output is correct |
70 | Correct | 219 ms | 25464 KB | Output is correct |
71 | Correct | 301 ms | 25464 KB | Output is correct |
72 | Correct | 195 ms | 25592 KB | Output is correct |
73 | Correct | 230 ms | 25592 KB | Output is correct |
74 | Correct | 5 ms | 376 KB | Output is correct |
75 | Correct | 6 ms | 1016 KB | Output is correct |
76 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 892 KB | Output is correct |
2 | Correct | 5 ms | 888 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 888 KB | Output is correct |
5 | Correct | 7 ms | 888 KB | Output is correct |
6 | Correct | 5 ms | 892 KB | Output is correct |
7 | Correct | 5 ms | 632 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 6 ms | 760 KB | Output is correct |
10 | Correct | 6 ms | 888 KB | Output is correct |
11 | Correct | 5 ms | 888 KB | Output is correct |
12 | Correct | 5 ms | 888 KB | Output is correct |
13 | Correct | 5 ms | 888 KB | Output is correct |
14 | Correct | 5 ms | 1016 KB | Output is correct |
15 | Correct | 5 ms | 1016 KB | Output is correct |
16 | Correct | 6 ms | 1016 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 82 ms | 15096 KB | Output is correct |
19 | Correct | 48 ms | 12028 KB | Output is correct |
20 | Correct | 50 ms | 11512 KB | Output is correct |
21 | Correct | 18 ms | 7672 KB | Output is correct |
22 | Correct | 64 ms | 12024 KB | Output is correct |
23 | Correct | 61 ms | 12024 KB | Output is correct |
24 | Correct | 30 ms | 5368 KB | Output is correct |
25 | Correct | 26 ms | 5368 KB | Output is correct |
26 | Correct | 117 ms | 20216 KB | Output is correct |
27 | Correct | 88 ms | 17656 KB | Output is correct |
28 | Correct | 57 ms | 15096 KB | Output is correct |
29 | Correct | 65 ms | 12152 KB | Output is correct |
30 | Correct | 91 ms | 13304 KB | Output is correct |
31 | Correct | 127 ms | 13176 KB | Output is correct |
32 | Correct | 83 ms | 11028 KB | Output is correct |
33 | Correct | 46 ms | 9848 KB | Output is correct |
34 | Correct | 53 ms | 11512 KB | Output is correct |
35 | Correct | 65 ms | 11512 KB | Output is correct |
36 | Correct | 67 ms | 11512 KB | Output is correct |
37 | Correct | 62 ms | 11388 KB | Output is correct |
38 | Correct | 63 ms | 11512 KB | Output is correct |
39 | Correct | 49 ms | 11512 KB | Output is correct |
40 | Correct | 59 ms | 11644 KB | Output is correct |
41 | Correct | 62 ms | 11512 KB | Output is correct |
42 | Correct | 54 ms | 11384 KB | Output is correct |
43 | Correct | 65 ms | 11512 KB | Output is correct |
44 | Correct | 54 ms | 11512 KB | Output is correct |
45 | Correct | 53 ms | 11384 KB | Output is correct |
46 | Correct | 50 ms | 11512 KB | Output is correct |
47 | Correct | 42 ms | 12024 KB | Output is correct |
48 | Correct | 44 ms | 12024 KB | Output is correct |
49 | Correct | 62 ms | 12028 KB | Output is correct |
50 | Correct | 5 ms | 376 KB | Output is correct |
51 | Correct | 6 ms | 1016 KB | Output is correct |
52 | Correct | 5 ms | 376 KB | Output is correct |
53 | Correct | 831 ms | 52600 KB | Output is correct |
54 | Correct | 183 ms | 26232 KB | Output is correct |
55 | Correct | 255 ms | 25852 KB | Output is correct |
56 | Correct | 111 ms | 22012 KB | Output is correct |
57 | Correct | 295 ms | 26104 KB | Output is correct |
58 | Correct | 159 ms | 13748 KB | Output is correct |
59 | Correct | 150 ms | 13688 KB | Output is correct |
60 | Correct | 674 ms | 53984 KB | Output is correct |
61 | Correct | 536 ms | 59260 KB | Output is correct |
62 | Correct | 394 ms | 59512 KB | Output is correct |
63 | Correct | 471 ms | 66680 KB | Output is correct |
64 | Correct | 563 ms | 41720 KB | Output is correct |
65 | Correct | 632 ms | 59512 KB | Output is correct |
66 | Correct | 167 ms | 22392 KB | Output is correct |
67 | Correct | 744 ms | 37372 KB | Output is correct |
68 | Correct | 262 ms | 22008 KB | Output is correct |
69 | Correct | 258 ms | 25336 KB | Output is correct |
70 | Correct | 246 ms | 25320 KB | Output is correct |
71 | Correct | 229 ms | 25464 KB | Output is correct |
72 | Correct | 211 ms | 25464 KB | Output is correct |
73 | Correct | 276 ms | 25592 KB | Output is correct |
74 | Correct | 298 ms | 25592 KB | Output is correct |
75 | Correct | 219 ms | 25592 KB | Output is correct |
76 | Correct | 206 ms | 25592 KB | Output is correct |
77 | Correct | 304 ms | 25592 KB | Output is correct |
78 | Correct | 197 ms | 25340 KB | Output is correct |
79 | Correct | 293 ms | 26000 KB | Output is correct |
80 | Correct | 289 ms | 25592 KB | Output is correct |
81 | Correct | 292 ms | 25464 KB | Output is correct |
82 | Correct | 265 ms | 25464 KB | Output is correct |
83 | Correct | 214 ms | 25464 KB | Output is correct |
84 | Correct | 218 ms | 25684 KB | Output is correct |
85 | Correct | 203 ms | 25592 KB | Output is correct |
86 | Correct | 202 ms | 25464 KB | Output is correct |
87 | Correct | 219 ms | 25464 KB | Output is correct |
88 | Correct | 301 ms | 25464 KB | Output is correct |
89 | Correct | 195 ms | 25592 KB | Output is correct |
90 | Correct | 230 ms | 25592 KB | Output is correct |
91 | Correct | 5 ms | 376 KB | Output is correct |
92 | Correct | 6 ms | 1016 KB | Output is correct |
93 | Correct | 5 ms | 376 KB | Output is correct |
94 | Correct | 620 ms | 48912 KB | Output is correct |
95 | Correct | 237 ms | 26232 KB | Output is correct |
96 | Correct | 342 ms | 25824 KB | Output is correct |
97 | Correct | 185 ms | 14648 KB | Output is correct |
98 | Correct | 100 ms | 22136 KB | Output is correct |
99 | Correct | 289 ms | 26232 KB | Output is correct |
100 | Correct | 147 ms | 13804 KB | Output is correct |
101 | Correct | 198 ms | 13688 KB | Output is correct |
102 | Correct | 330 ms | 36600 KB | Output is correct |
103 | Correct | 910 ms | 64700 KB | Output is correct |
104 | Correct | 311 ms | 57080 KB | Output is correct |
105 | Correct | 773 ms | 57720 KB | Output is correct |
106 | Correct | 1345 ms | 57848 KB | Output is correct |
107 | Correct | 597 ms | 48376 KB | Output is correct |
108 | Correct | 824 ms | 40824 KB | Output is correct |
109 | Correct | 306 ms | 29156 KB | Output is correct |
110 | Correct | 296 ms | 22396 KB | Output is correct |
111 | Correct | 274 ms | 26236 KB | Output is correct |
112 | Correct | 354 ms | 25976 KB | Output is correct |
113 | Correct | 234 ms | 25592 KB | Output is correct |
114 | Correct | 205 ms | 25720 KB | Output is correct |
115 | Correct | 346 ms | 25592 KB | Output is correct |
116 | Correct | 297 ms | 25872 KB | Output is correct |
117 | Correct | 341 ms | 25976 KB | Output is correct |
118 | Correct | 370 ms | 26020 KB | Output is correct |
119 | Correct | 244 ms | 25848 KB | Output is correct |
120 | Correct | 261 ms | 25948 KB | Output is correct |
121 | Correct | 822 ms | 52472 KB | Output is correct |
122 | Correct | 176 ms | 26104 KB | Output is correct |
123 | Correct | 254 ms | 25724 KB | Output is correct |
124 | Correct | 5 ms | 376 KB | Output is correct |
125 | Correct | 5 ms | 1016 KB | Output is correct |
126 | Correct | 5 ms | 376 KB | Output is correct |