Submission #244187

# Submission time Handle Problem Language Result Execution time Memory
244187 2020-07-02T18:11:57 Z MatesV13 Ili (COI17_ili) C++11
7 / 100
8 ms 512 KB
#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 time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
8 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Halted 0 ms 0 KB -