# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
516114 |
2022-01-20T11:52:24 Z |
Mahdi |
Ili (COI17_ili) |
C++17 |
|
1 ms |
312 KB |
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef long long ll;
typedef pair<int, int> pii;
const int N=50;
int n, m, l[N], r[N], a[N], b[N];
string s;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n>>m>>s;
for(int i=0;i<m;++i){
string x;
cin>>x;
if(x[0]=='x')
l[i+n]=x[1]-'1';
else
l[i+n]=n+x[1]-'1';
cin>>x;
if(x[0]=='x')
r[i+n]=x[1]-'1';
else
r[i+n]=n+x[1]-'1';
}
int z=0;
for(int i=0;i<(1<<n);++i){
int x=i;
for(int j=0;j<n;++j){
b[j]=x%2;
x/=2;
}
for(int j=n;j<n+m;++j){
if(b[l[j]]==1 || b[r[j]]==1)
b[j]=1;
else
b[j]=0;
}
bool bl=true;
for(int j=0;j<m;++j){
if((s[j]=='1' && b[j+n]==0) || (s[j]=='0' && b[j+n]==1)){
bl=0;
break;
}
}
if(bl){
for(int j=n;j<n+m;++j)
a[j]+=b[j];
++z;
}
}
for(int i=n;i<n+m;++i){
if(a[i]==0)
cout<<'0';
else if(a[i]==z)
cout<<'1';
else
cout<<'?';
}
cout<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |