# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
145303 |
2019-08-19T14:38:09 Z |
SamAnd |
Ili (COI17_ili) |
C++17 |
|
4000 ms |
7804 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 10004;
int n, m;
bitset<N> a[N];
char anss[N], ans[N];
bitset<N> x0;
int main()
{
cin >> n >> m;
cin >> anss;
for (int i = 1; i <= m; ++i)
ans[i] = anss[i - 1];
for (int i = 1; i <= m; ++i)
{
char s1, s2;
int x1, x2;
cin >> s1 >> x1 >> s2 >> x2;
if (s1 == 'c')
a[i] = a[x1];
else
a[i][x1] = 1;
if (s2 == 'c')
a[i] = (a[i] | a[x2]);
else
a[i][x2] = 1;
}
for (int i = 1; i <= m; ++i)
{
if (ans[i] == '0')
{
x0 = (x0 | a[i]);
}
}
for (int i = 1; i <= m; ++i)
{
if ((a[i] & x0) == a[i])
ans[i] = '0';
}
for (int i = 1; i <= m; ++i)
{
for (int j = 1; j <= m; ++j)
{
if (ans[j] == '1' && (a[i] & (a[j] ^ (a[j] & x0))) == (a[j] ^ (a[j] & x0)))
ans[i] = '1';
}
}
for (int i = 1; i <= m; ++i)
cout << ans[i];
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
87 ms |
1004 KB |
Output is correct |
9 |
Correct |
20 ms |
760 KB |
Output is correct |
10 |
Correct |
60 ms |
888 KB |
Output is correct |
11 |
Correct |
63 ms |
888 KB |
Output is correct |
12 |
Correct |
72 ms |
888 KB |
Output is correct |
13 |
Correct |
81 ms |
888 KB |
Output is correct |
14 |
Correct |
86 ms |
1036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
87 ms |
1004 KB |
Output is correct |
9 |
Correct |
20 ms |
760 KB |
Output is correct |
10 |
Correct |
60 ms |
888 KB |
Output is correct |
11 |
Correct |
63 ms |
888 KB |
Output is correct |
12 |
Correct |
72 ms |
888 KB |
Output is correct |
13 |
Correct |
81 ms |
888 KB |
Output is correct |
14 |
Correct |
86 ms |
1036 KB |
Output is correct |
15 |
Execution timed out |
4053 ms |
7804 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |