# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235709 | 2020-05-29T12:47:59 Z | Kalam | Ili (COI17_ili) | C++11 | 1046 ms | 13560 KB |
// KALAM # include<bits/stdc++.h> using namespace std; const int N = 10000 + 77; int n , m , F[N] , G[N]; bitset < N > B[N] , P , I , E; vector < int > adj[N]; char S[N]; int main() { scanf("%d %d" , & n , & m); scanf("%s" , S + 1); for(int i = 1;i <= n;++ i) P[i] = 1 , I[i] = 1; for(int i = 1;i <= m;++ i) { int k = 2; while(k --) { char c; int x; scanf(" %c%d" , & c , & x); if(c == 'x') B[i][x] = 1 , adj[i].push_back(x); else B[i] |= B[x] , adj[i].push_back(-x); } if(S[i] == '0') P = (P & (I ^ B[i])); } for(int i = 1;i <= m;++ i) B[i] &= P; for(int i = 1;i <= m;++ i) if(B[i] == E && S[i] == '?') S[i] = '0'; for(int i = 1;i <= m;++ i) { if(S[i] != '?') continue ; memset(F , 0 , sizeof F); memset(G , 0 , sizeof G); for(int j = 1;j <= n;++ j) F[j] = (P[j] & (!B[i][j])); for(int j = 1;j <= m;++ j) { for(int x : adj[j]) { if(x >= 0) G[j] |= F[x]; else G[j] |= G[-x]; } } bool good = 1; for(int j = 1;j <= m;++ j) if(S[j] != '?') good &= (G[j] == (S[j] - '0')); if(!good) S[i] = '1'; } for(int i = 1;i <= m;++ i) printf("%c" , S[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 640 KB | Output is correct |
2 | Correct | 5 ms | 640 KB | Output is correct |
3 | Correct | 5 ms | 640 KB | Output is correct |
4 | Correct | 5 ms | 640 KB | Output is correct |
5 | Correct | 5 ms | 640 KB | Output is correct |
6 | Correct | 5 ms | 640 KB | Output is correct |
7 | Correct | 5 ms | 640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 640 KB | Output is correct |
2 | Correct | 5 ms | 640 KB | Output is correct |
3 | Correct | 5 ms | 640 KB | Output is correct |
4 | Correct | 5 ms | 640 KB | Output is correct |
5 | Correct | 5 ms | 640 KB | Output is correct |
6 | Correct | 5 ms | 640 KB | Output is correct |
7 | Correct | 5 ms | 640 KB | Output is correct |
8 | Correct | 7 ms | 1280 KB | Output is correct |
9 | Correct | 7 ms | 1152 KB | Output is correct |
10 | Correct | 7 ms | 1280 KB | Output is correct |
11 | Correct | 7 ms | 1280 KB | Output is correct |
12 | Correct | 7 ms | 1280 KB | Output is correct |
13 | Correct | 7 ms | 1296 KB | Output is correct |
14 | Correct | 8 ms | 1280 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 640 KB | Output is correct |
2 | Correct | 5 ms | 640 KB | Output is correct |
3 | Correct | 5 ms | 640 KB | Output is correct |
4 | Correct | 5 ms | 640 KB | Output is correct |
5 | Correct | 5 ms | 640 KB | Output is correct |
6 | Correct | 5 ms | 640 KB | Output is correct |
7 | Correct | 5 ms | 640 KB | Output is correct |
8 | Correct | 7 ms | 1280 KB | Output is correct |
9 | Correct | 7 ms | 1152 KB | Output is correct |
10 | Correct | 7 ms | 1280 KB | Output is correct |
11 | Correct | 7 ms | 1280 KB | Output is correct |
12 | Correct | 7 ms | 1280 KB | Output is correct |
13 | Correct | 7 ms | 1296 KB | Output is correct |
14 | Correct | 8 ms | 1280 KB | Output is correct |
15 | Correct | 191 ms | 8320 KB | Output is correct |
16 | Correct | 474 ms | 9704 KB | Output is correct |
17 | Correct | 388 ms | 11392 KB | Output is correct |
18 | Correct | 970 ms | 13436 KB | Output is correct |
19 | Correct | 393 ms | 9728 KB | Output is correct |
20 | Correct | 934 ms | 13312 KB | Output is correct |
21 | Correct | 1046 ms | 13440 KB | Output is correct |
22 | Correct | 270 ms | 12920 KB | Output is correct |
23 | Correct | 313 ms | 13432 KB | Output is correct |
24 | Correct | 299 ms | 13432 KB | Output is correct |
25 | Correct | 297 ms | 13432 KB | Output is correct |
26 | Correct | 295 ms | 13196 KB | Output is correct |
27 | Correct | 367 ms | 13304 KB | Output is correct |
28 | Correct | 308 ms | 12916 KB | Output is correct |
29 | Correct | 267 ms | 13056 KB | Output is correct |
30 | Correct | 307 ms | 13144 KB | Output is correct |
31 | Correct | 286 ms | 13480 KB | Output is correct |
32 | Correct | 314 ms | 13560 KB | Output is correct |