제출 #244187

#제출 시각아이디문제언어결과실행 시간메모리
244187MatesV13Ili (COI17_ili)C++11
7 / 100
8 ms512 KiB
#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; for (int j=n+1; j<=n+m; j++) y[j]=x[j]; } for (int j=n+1; j<=n+m; j++) if (y[j]!=x[j]) y[j]=-1; } for (int j=n+1; j<=n+m; j++) if (y[j]==-1) cout << '?'; else cout << y[j]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...