# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
232280 |
2020-05-16T14:26:10 Z |
pedy4000 |
Ili (COI17_ili) |
C++14 |
|
717 ms |
1280 KB |
#include <algorithm>
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
const int N = 1e4 + 8;
int n, m;
string s;
int type[N * 2];
bool can[N * 2][2];
bool mark[N * 2];
vector <int> in[N * 2];
vector <int> out[N * 2];
int main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> m >> s;
for (int i = 0; i < m; i++)
type[i] = (s[i] == '?'? 2: s[i] - '0');
for (int i = m; i < m + n; i++)
type[i] = 2;
for (int i = 0; i < m; i++)
for (int j = 0; j < 2; j++) {
char c;
int ind;
cin >> c >> ind;
ind--;
if (c == 'x')
ind += m;
in[i].push_back(ind);
out[ind].push_back(i);
}
for (int mask = 0; mask < (1 << n); mask++) {
for (int i = m; i < m + n; i++)
mark[i] = (mask >> (i - m)) & 1;
for (int i = 0; i < m; i++)
mark[i] = mark[in[i][0]] | mark[in[i][1]];
bool ok = true;
for (int i = 0; i < m + n; i++)
if (type[i] < 2 && type[i] != mark[i])
ok = false;
if (ok)
for (int i = 0; i < m; i++)
can[i][mark[i]] = true;
}
for (int i = 0; i < m; i++) {
if (can[i][0] && !can[i][1])
cout << '0';
if (!can[i][0] && can[i][1])
cout << '1';
if (can[i][0] && can[i][1])
cout << '?';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1280 KB |
Output is correct |
2 |
Correct |
5 ms |
1280 KB |
Output is correct |
3 |
Correct |
5 ms |
1280 KB |
Output is correct |
4 |
Correct |
6 ms |
1280 KB |
Output is correct |
5 |
Correct |
7 ms |
1280 KB |
Output is correct |
6 |
Correct |
6 ms |
1280 KB |
Output is correct |
7 |
Correct |
8 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1280 KB |
Output is correct |
2 |
Correct |
5 ms |
1280 KB |
Output is correct |
3 |
Correct |
5 ms |
1280 KB |
Output is correct |
4 |
Correct |
6 ms |
1280 KB |
Output is correct |
5 |
Correct |
7 ms |
1280 KB |
Output is correct |
6 |
Correct |
6 ms |
1280 KB |
Output is correct |
7 |
Correct |
8 ms |
1280 KB |
Output is correct |
8 |
Incorrect |
717 ms |
1280 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1280 KB |
Output is correct |
2 |
Correct |
5 ms |
1280 KB |
Output is correct |
3 |
Correct |
5 ms |
1280 KB |
Output is correct |
4 |
Correct |
6 ms |
1280 KB |
Output is correct |
5 |
Correct |
7 ms |
1280 KB |
Output is correct |
6 |
Correct |
6 ms |
1280 KB |
Output is correct |
7 |
Correct |
8 ms |
1280 KB |
Output is correct |
8 |
Incorrect |
717 ms |
1280 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |