# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235704 | Kalam | Ili (COI17_ili) | C++11 | 4051 ms | 12672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// KALAM
# include<bits/stdc++.h>
using namespace std;
const int N = 10000 + 77;
int n , m;
bitset < N > B[N] , P , I , E;
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;
else B[i] |= B[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(S[i] == '?')
for(int j = 1;j <= m;++ j)
if(i != j && S[j] == '1')
if((B[i] & B[j]) == B[j])
S[i] = '1';
for(int i = 1;i <= m;++ i)
if(B[i] == E && S[i] == '?')
S[i] = '0';
for(int i = 1;i <= m;++ i)
printf("%c" , S[i]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |