#include<iostream>
#include<bitset>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
//const int MAXN=10010;
const int MAXN=10;
int n, m;
string info, ans;
bitset<MAXN> arr[MAXN], one("1"), nuli;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m >> info;
ans.assign(m, '?');
forn(i, m){
char c1, c2;
int a1, a2;
cin >> c1 >> a1 >> c2 >> a2;
--a1, --a2;
bitset<MAXN> bi1 = c1=='x'? (one<<a1) : arr[a1];
bitset<MAXN> bi2 = c2=='x'? (one<<a2) : arr[a2];
arr[i]=bi1|bi2;
}
forn(i, m) if(info[i]=='0') nuli|=arr[i];
nuli=~nuli;
forn(i, m){
arr[i]&=nuli;
if(arr[i].count()==0) ans[i]='0';
}
forn(i, m) if(ans[i]!='0'){
bool put=false;
forn(j, m) if(info[j]=='1') put|=(arr[j] & arr[i])==arr[j];
if(put) ans[i]='1';
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |