#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
const int MN = 120001;
int n, q, u, v;
bitset<MN> b[MN];
char c;
int32_t main() {
boost();
cin >> n >> q;
for (int i = 1; i <= n; i++) b[i][i] = 1;
for (int i = 1; i < n + q; i++) {
cin >> c >> u;
if (c != 'C') cin >> v;
if (c == 'S') {
b[u] |= b[v];
b[v] |= b[u];
} else if (c == 'Q') {
if (b[u][v]) printf("yes\n");
else printf("no\n");
} else {
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
2160 KB |
Output is correct |
2 |
Correct |
74 ms |
60788 KB |
Output is correct |
3 |
Correct |
64 ms |
60824 KB |
Output is correct |
4 |
Correct |
91 ms |
60748 KB |
Output is correct |
5 |
Correct |
68 ms |
60712 KB |
Output is correct |
6 |
Correct |
78 ms |
60832 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
2160 KB |
Output is correct |
2 |
Correct |
74 ms |
60788 KB |
Output is correct |
3 |
Correct |
64 ms |
60824 KB |
Output is correct |
4 |
Correct |
91 ms |
60748 KB |
Output is correct |
5 |
Correct |
68 ms |
60712 KB |
Output is correct |
6 |
Correct |
78 ms |
60832 KB |
Output is correct |
7 |
Incorrect |
23 ms |
1724 KB |
Extra information in the output file |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
2196 KB |
Output is correct |
2 |
Runtime error |
207 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
2196 KB |
Output is correct |
2 |
Runtime error |
207 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1292 KB |
Output is correct |
2 |
Runtime error |
222 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1292 KB |
Output is correct |
2 |
Runtime error |
222 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1612 KB |
Output is correct |
2 |
Runtime error |
196 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1612 KB |
Output is correct |
2 |
Runtime error |
196 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1624 KB |
Output is correct |
2 |
Runtime error |
224 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1624 KB |
Output is correct |
2 |
Runtime error |
224 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1648 KB |
Output is correct |
2 |
Correct |
77 ms |
59620 KB |
Output is correct |
3 |
Correct |
66 ms |
59676 KB |
Output is correct |
4 |
Correct |
76 ms |
59588 KB |
Output is correct |
5 |
Correct |
76 ms |
59668 KB |
Output is correct |
6 |
Correct |
84 ms |
59680 KB |
Output is correct |
7 |
Correct |
21 ms |
1628 KB |
Output is correct |
8 |
Runtime error |
195 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1648 KB |
Output is correct |
2 |
Correct |
77 ms |
59620 KB |
Output is correct |
3 |
Correct |
66 ms |
59676 KB |
Output is correct |
4 |
Correct |
76 ms |
59588 KB |
Output is correct |
5 |
Correct |
76 ms |
59668 KB |
Output is correct |
6 |
Correct |
84 ms |
59680 KB |
Output is correct |
7 |
Correct |
21 ms |
1628 KB |
Output is correct |
8 |
Runtime error |
195 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |