# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62717 | 2018-07-29T21:41:34 Z | eriksuenderhauf | Genetics (BOI18_genetics) | C++11 | 2000 ms | 70904 KB |
#pragma GCC optimize("O3") #include <bits/stdc++.h> #define enl printf("\n") #define case(t) printf("Case #%d: ", (t)) #define ni(n) scanf("%d", &(n)) #define nl(n) scanf("%I64d", &(n)) #define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i]) #define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i]) #define pri(n) printf("%d\n", (n)) #define prl(n) printf("%I64d\n", (n)) #define pii pair<int, int> #define vii vector<pii> #define vi vector<int> #define pb push_back #define mp make_pair #define fi first #define se second typedef long long ll; const double pi = acos(-1); const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const int MAXN = 5e3 + 5; const double eps = 1e-9; using namespace std; char str[MAXN][MAXN]; bitset<MAXN> a[MAXN][4]; int cnt[MAXN][4]; short vis[MAXN][MAXN]; short ind[MAXN]; int go(char c) { if (c == 'A') return 0; else if (c == 'C') return 1; else if (c == 'G') return 2; else if (c == 'T') return 3; } int main() { int n, m, k; ni(n), ni(m), ni(k); for (int i = 0; i < n; i++) { scanf("%s", str[i]); for (int j = 0; j < m; j++) { int cur = go(str[i][j]); a[i][cur][j] = 1; cnt[j][cur]++; vis[i][j] = -1; } for (int j = m; j < n; j++) vis[i][j] = -1; ind[i] = i; } random_shuffle(ind, ind + n); for (int yl = 0; yl < n; yl++) { int i = yl; int tmp = 0; for (short j = 0; j < m; j++) tmp += n - cnt[j][go(str[i][j])]; if (tmp != k * (n - 1)) continue; bool fl = 0; for (short j = n - 1; j >= 0; j--) { if (i == j) continue; short val = 0; if (vis[i][j] != -1) val = vis[i][j]; else { for (short b = 0; b < 4; b++) { val += (a[i][b] ^ a[j][b]).count(); if (val > 2 * k) break; } vis[i][j] = val; vis[j][i] = val; } if (val != 2 * k) { fl = 1; break; } } if (fl) continue; return !pri(i + 1); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1272 KB | Output is correct |
2 | Correct | 5 ms | 1400 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 1144 KB | Output is correct |
5 | Correct | 6 ms | 1400 KB | Output is correct |
6 | Correct | 5 ms | 1404 KB | Output is correct |
7 | Correct | 6 ms | 888 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 1020 KB | Output is correct |
10 | Correct | 6 ms | 1400 KB | Output is correct |
11 | Correct | 5 ms | 1272 KB | Output is correct |
12 | Correct | 6 ms | 1400 KB | Output is correct |
13 | Correct | 6 ms | 1400 KB | Output is correct |
14 | Correct | 5 ms | 1400 KB | Output is correct |
15 | Correct | 6 ms | 1400 KB | Output is correct |
16 | Correct | 5 ms | 1400 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 116 ms | 22880 KB | Output is correct |
2 | Correct | 56 ms | 27128 KB | Output is correct |
3 | Correct | 73 ms | 25976 KB | Output is correct |
4 | Correct | 26 ms | 15608 KB | Output is correct |
5 | Correct | 56 ms | 27128 KB | Output is correct |
6 | Correct | 64 ms | 27256 KB | Output is correct |
7 | Correct | 35 ms | 11768 KB | Output is correct |
8 | Correct | 31 ms | 11768 KB | Output is correct |
9 | Correct | 57 ms | 25848 KB | Output is correct |
10 | Correct | 112 ms | 25848 KB | Output is correct |
11 | Correct | 333 ms | 22776 KB | Output is correct |
12 | Correct | 70 ms | 22776 KB | Output is correct |
13 | Correct | 91 ms | 22648 KB | Output is correct |
14 | Correct | 98 ms | 19448 KB | Output is correct |
15 | Correct | 55 ms | 19704 KB | Output is correct |
16 | Correct | 48 ms | 21624 KB | Output is correct |
17 | Correct | 67 ms | 26104 KB | Output is correct |
18 | Correct | 52 ms | 25848 KB | Output is correct |
19 | Correct | 65 ms | 26108 KB | Output is correct |
20 | Correct | 56 ms | 25724 KB | Output is correct |
21 | Correct | 65 ms | 26104 KB | Output is correct |
22 | Correct | 73 ms | 25976 KB | Output is correct |
23 | Correct | 72 ms | 25976 KB | Output is correct |
24 | Correct | 71 ms | 25940 KB | Output is correct |
25 | Correct | 57 ms | 25720 KB | Output is correct |
26 | Correct | 60 ms | 25848 KB | Output is correct |
27 | Correct | 60 ms | 25724 KB | Output is correct |
28 | Correct | 58 ms | 25724 KB | Output is correct |
29 | Correct | 67 ms | 25976 KB | Output is correct |
30 | Correct | 49 ms | 27128 KB | Output is correct |
31 | Correct | 55 ms | 27124 KB | Output is correct |
32 | Correct | 61 ms | 27128 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 1528 KB | Output is correct |
35 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 116 ms | 22880 KB | Output is correct |
2 | Correct | 56 ms | 27128 KB | Output is correct |
3 | Correct | 73 ms | 25976 KB | Output is correct |
4 | Correct | 26 ms | 15608 KB | Output is correct |
5 | Correct | 56 ms | 27128 KB | Output is correct |
6 | Correct | 64 ms | 27256 KB | Output is correct |
7 | Correct | 35 ms | 11768 KB | Output is correct |
8 | Correct | 31 ms | 11768 KB | Output is correct |
9 | Correct | 57 ms | 25848 KB | Output is correct |
10 | Correct | 112 ms | 25848 KB | Output is correct |
11 | Correct | 333 ms | 22776 KB | Output is correct |
12 | Correct | 70 ms | 22776 KB | Output is correct |
13 | Correct | 91 ms | 22648 KB | Output is correct |
14 | Correct | 98 ms | 19448 KB | Output is correct |
15 | Correct | 55 ms | 19704 KB | Output is correct |
16 | Correct | 48 ms | 21624 KB | Output is correct |
17 | Correct | 67 ms | 26104 KB | Output is correct |
18 | Correct | 52 ms | 25848 KB | Output is correct |
19 | Correct | 65 ms | 26108 KB | Output is correct |
20 | Correct | 56 ms | 25724 KB | Output is correct |
21 | Correct | 65 ms | 26104 KB | Output is correct |
22 | Correct | 73 ms | 25976 KB | Output is correct |
23 | Correct | 72 ms | 25976 KB | Output is correct |
24 | Correct | 71 ms | 25940 KB | Output is correct |
25 | Correct | 57 ms | 25720 KB | Output is correct |
26 | Correct | 60 ms | 25848 KB | Output is correct |
27 | Correct | 60 ms | 25724 KB | Output is correct |
28 | Correct | 58 ms | 25724 KB | Output is correct |
29 | Correct | 67 ms | 25976 KB | Output is correct |
30 | Correct | 49 ms | 27128 KB | Output is correct |
31 | Correct | 55 ms | 27124 KB | Output is correct |
32 | Correct | 61 ms | 27128 KB | Output is correct |
33 | Correct | 5 ms | 376 KB | Output is correct |
34 | Correct | 6 ms | 1528 KB | Output is correct |
35 | Correct | 5 ms | 376 KB | Output is correct |
36 | Correct | 291 ms | 61880 KB | Output is correct |
37 | Correct | 218 ms | 70776 KB | Output is correct |
38 | Correct | 323 ms | 69112 KB | Output is correct |
39 | Correct | 121 ms | 59640 KB | Output is correct |
40 | Correct | 282 ms | 70776 KB | Output is correct |
41 | Correct | 151 ms | 35624 KB | Output is correct |
42 | Correct | 129 ms | 35576 KB | Output is correct |
43 | Correct | 264 ms | 59768 KB | Output is correct |
44 | Correct | 280 ms | 70904 KB | Output is correct |
45 | Correct | 536 ms | 70776 KB | Output is correct |
46 | Correct | 247 ms | 70904 KB | Output is correct |
47 | Correct | 540 ms | 61944 KB | Output is correct |
48 | Correct | 1908 ms | 62112 KB | Output is correct |
49 | Correct | 293 ms | 53112 KB | Output is correct |
50 | Correct | 238 ms | 53112 KB | Output is correct |
51 | Correct | 250 ms | 59768 KB | Output is correct |
52 | Correct | 300 ms | 69112 KB | Output is correct |
53 | Correct | 302 ms | 68984 KB | Output is correct |
54 | Correct | 202 ms | 69100 KB | Output is correct |
55 | Correct | 234 ms | 69112 KB | Output is correct |
56 | Correct | 225 ms | 69112 KB | Output is correct |
57 | Correct | 330 ms | 69380 KB | Output is correct |
58 | Correct | 274 ms | 69240 KB | Output is correct |
59 | Correct | 248 ms | 68856 KB | Output is correct |
60 | Correct | 239 ms | 69240 KB | Output is correct |
61 | Correct | 243 ms | 68856 KB | Output is correct |
62 | Correct | 235 ms | 68600 KB | Output is correct |
63 | Correct | 226 ms | 69112 KB | Output is correct |
64 | Correct | 238 ms | 69112 KB | Output is correct |
65 | Correct | 305 ms | 69112 KB | Output is correct |
66 | Correct | 288 ms | 68944 KB | Output is correct |
67 | Correct | 300 ms | 69460 KB | Output is correct |
68 | Correct | 264 ms | 69240 KB | Output is correct |
69 | Correct | 221 ms | 68856 KB | Output is correct |
70 | Correct | 294 ms | 69240 KB | Output is correct |
71 | Correct | 266 ms | 68856 KB | Output is correct |
72 | Correct | 272 ms | 69368 KB | Output is correct |
73 | Correct | 285 ms | 68844 KB | Output is correct |
74 | Correct | 5 ms | 504 KB | Output is correct |
75 | Correct | 5 ms | 1400 KB | Output is correct |
76 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 1272 KB | Output is correct |
2 | Correct | 5 ms | 1400 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 1144 KB | Output is correct |
5 | Correct | 6 ms | 1400 KB | Output is correct |
6 | Correct | 5 ms | 1404 KB | Output is correct |
7 | Correct | 6 ms | 888 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 1020 KB | Output is correct |
10 | Correct | 6 ms | 1400 KB | Output is correct |
11 | Correct | 5 ms | 1272 KB | Output is correct |
12 | Correct | 6 ms | 1400 KB | Output is correct |
13 | Correct | 6 ms | 1400 KB | Output is correct |
14 | Correct | 5 ms | 1400 KB | Output is correct |
15 | Correct | 6 ms | 1400 KB | Output is correct |
16 | Correct | 5 ms | 1400 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 116 ms | 22880 KB | Output is correct |
19 | Correct | 56 ms | 27128 KB | Output is correct |
20 | Correct | 73 ms | 25976 KB | Output is correct |
21 | Correct | 26 ms | 15608 KB | Output is correct |
22 | Correct | 56 ms | 27128 KB | Output is correct |
23 | Correct | 64 ms | 27256 KB | Output is correct |
24 | Correct | 35 ms | 11768 KB | Output is correct |
25 | Correct | 31 ms | 11768 KB | Output is correct |
26 | Correct | 57 ms | 25848 KB | Output is correct |
27 | Correct | 112 ms | 25848 KB | Output is correct |
28 | Correct | 333 ms | 22776 KB | Output is correct |
29 | Correct | 70 ms | 22776 KB | Output is correct |
30 | Correct | 91 ms | 22648 KB | Output is correct |
31 | Correct | 98 ms | 19448 KB | Output is correct |
32 | Correct | 55 ms | 19704 KB | Output is correct |
33 | Correct | 48 ms | 21624 KB | Output is correct |
34 | Correct | 67 ms | 26104 KB | Output is correct |
35 | Correct | 52 ms | 25848 KB | Output is correct |
36 | Correct | 65 ms | 26108 KB | Output is correct |
37 | Correct | 56 ms | 25724 KB | Output is correct |
38 | Correct | 65 ms | 26104 KB | Output is correct |
39 | Correct | 73 ms | 25976 KB | Output is correct |
40 | Correct | 72 ms | 25976 KB | Output is correct |
41 | Correct | 71 ms | 25940 KB | Output is correct |
42 | Correct | 57 ms | 25720 KB | Output is correct |
43 | Correct | 60 ms | 25848 KB | Output is correct |
44 | Correct | 60 ms | 25724 KB | Output is correct |
45 | Correct | 58 ms | 25724 KB | Output is correct |
46 | Correct | 67 ms | 25976 KB | Output is correct |
47 | Correct | 49 ms | 27128 KB | Output is correct |
48 | Correct | 55 ms | 27124 KB | Output is correct |
49 | Correct | 61 ms | 27128 KB | Output is correct |
50 | Correct | 5 ms | 376 KB | Output is correct |
51 | Correct | 6 ms | 1528 KB | Output is correct |
52 | Correct | 5 ms | 376 KB | Output is correct |
53 | Correct | 291 ms | 61880 KB | Output is correct |
54 | Correct | 218 ms | 70776 KB | Output is correct |
55 | Correct | 323 ms | 69112 KB | Output is correct |
56 | Correct | 121 ms | 59640 KB | Output is correct |
57 | Correct | 282 ms | 70776 KB | Output is correct |
58 | Correct | 151 ms | 35624 KB | Output is correct |
59 | Correct | 129 ms | 35576 KB | Output is correct |
60 | Correct | 264 ms | 59768 KB | Output is correct |
61 | Correct | 280 ms | 70904 KB | Output is correct |
62 | Correct | 536 ms | 70776 KB | Output is correct |
63 | Correct | 247 ms | 70904 KB | Output is correct |
64 | Correct | 540 ms | 61944 KB | Output is correct |
65 | Correct | 1908 ms | 62112 KB | Output is correct |
66 | Correct | 293 ms | 53112 KB | Output is correct |
67 | Correct | 238 ms | 53112 KB | Output is correct |
68 | Correct | 250 ms | 59768 KB | Output is correct |
69 | Correct | 300 ms | 69112 KB | Output is correct |
70 | Correct | 302 ms | 68984 KB | Output is correct |
71 | Correct | 202 ms | 69100 KB | Output is correct |
72 | Correct | 234 ms | 69112 KB | Output is correct |
73 | Correct | 225 ms | 69112 KB | Output is correct |
74 | Correct | 330 ms | 69380 KB | Output is correct |
75 | Correct | 274 ms | 69240 KB | Output is correct |
76 | Correct | 248 ms | 68856 KB | Output is correct |
77 | Correct | 239 ms | 69240 KB | Output is correct |
78 | Correct | 243 ms | 68856 KB | Output is correct |
79 | Correct | 235 ms | 68600 KB | Output is correct |
80 | Correct | 226 ms | 69112 KB | Output is correct |
81 | Correct | 238 ms | 69112 KB | Output is correct |
82 | Correct | 305 ms | 69112 KB | Output is correct |
83 | Correct | 288 ms | 68944 KB | Output is correct |
84 | Correct | 300 ms | 69460 KB | Output is correct |
85 | Correct | 264 ms | 69240 KB | Output is correct |
86 | Correct | 221 ms | 68856 KB | Output is correct |
87 | Correct | 294 ms | 69240 KB | Output is correct |
88 | Correct | 266 ms | 68856 KB | Output is correct |
89 | Correct | 272 ms | 69368 KB | Output is correct |
90 | Correct | 285 ms | 68844 KB | Output is correct |
91 | Correct | 5 ms | 504 KB | Output is correct |
92 | Correct | 5 ms | 1400 KB | Output is correct |
93 | Correct | 5 ms | 376 KB | Output is correct |
94 | Correct | 264 ms | 67192 KB | Output is correct |
95 | Correct | 248 ms | 70776 KB | Output is correct |
96 | Correct | 408 ms | 69496 KB | Output is correct |
97 | Correct | 221 ms | 38136 KB | Output is correct |
98 | Correct | 145 ms | 59640 KB | Output is correct |
99 | Correct | 316 ms | 70656 KB | Output is correct |
100 | Correct | 187 ms | 35704 KB | Output is correct |
101 | Correct | 161 ms | 35576 KB | Output is correct |
102 | Correct | 236 ms | 59864 KB | Output is correct |
103 | Correct | 438 ms | 70648 KB | Output is correct |
104 | Correct | 800 ms | 70776 KB | Output is correct |
105 | Correct | 523 ms | 70776 KB | Output is correct |
106 | Execution timed out | 2089 ms | 67192 KB | Time limit exceeded |
107 | Halted | 0 ms | 0 KB | - |