# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
244187 | MatesV13 | Ili (COI17_ili) | C++11 | 8 ms | 512 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.
#include <bits/stdc++.h>
using namespace std;
int n, m, x[45], y[45]; string s;
int br1, br2; char c1, c2;
pair<int, int> gr[45];
bool firsttime=1;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m; cin >> s;
for (int i=n+1; i<=n+m; i++){
cin >> c1 >> br1 >> c2 >> br2;
if (c1=='c') br1+=n;
if (c2=='c') br2+=n;
gr[i] = make_pair(br1, br2);
}
for (int i=0; i<(1<<n); i++){
int l=i;
for (int j=1; j<=n; j++){
x[j]=l%2; l/=2;
}
for (int j=n+1; j<=n+m; j++)
x[j]=x[gr[j].first] || x[gr[j].second];
bool ok=0;
for (int j=n+1; j<=n+m; j++)
if ((s[j-n-1]=='0' and x[j]==1) or (s[j-n-1]=='1' and x[j]==0))
ok=1;
if (ok) continue;
if (firsttime){
firsttime=0;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |