#include <bits/stdc++.h>
using namespace std;
#define ll long long
#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
1432 KB |
Output is correct |
2 |
Correct |
77 ms |
59460 KB |
Output is correct |
3 |
Correct |
60 ms |
59548 KB |
Output is correct |
4 |
Correct |
72 ms |
59464 KB |
Output is correct |
5 |
Correct |
70 ms |
59448 KB |
Output is correct |
6 |
Correct |
66 ms |
59568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
1432 KB |
Output is correct |
2 |
Correct |
77 ms |
59460 KB |
Output is correct |
3 |
Correct |
60 ms |
59548 KB |
Output is correct |
4 |
Correct |
72 ms |
59464 KB |
Output is correct |
5 |
Correct |
70 ms |
59448 KB |
Output is correct |
6 |
Correct |
66 ms |
59568 KB |
Output is correct |
7 |
Incorrect |
21 ms |
1668 KB |
Extra information in the output file |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
1484 KB |
Output is correct |
2 |
Runtime error |
200 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
1484 KB |
Output is correct |
2 |
Runtime error |
200 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
1524 KB |
Output is correct |
2 |
Runtime error |
189 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
1524 KB |
Output is correct |
2 |
Runtime error |
189 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
1356 KB |
Output is correct |
2 |
Runtime error |
193 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
1356 KB |
Output is correct |
2 |
Runtime error |
193 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
1356 KB |
Output is correct |
2 |
Runtime error |
201 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
1356 KB |
Output is correct |
2 |
Runtime error |
201 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
1320 KB |
Output is correct |
2 |
Correct |
75 ms |
59332 KB |
Output is correct |
3 |
Correct |
63 ms |
59448 KB |
Output is correct |
4 |
Correct |
85 ms |
59396 KB |
Output is correct |
5 |
Correct |
68 ms |
59312 KB |
Output is correct |
6 |
Correct |
72 ms |
59440 KB |
Output is correct |
7 |
Correct |
20 ms |
1328 KB |
Output is correct |
8 |
Runtime error |
199 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
1320 KB |
Output is correct |
2 |
Correct |
75 ms |
59332 KB |
Output is correct |
3 |
Correct |
63 ms |
59448 KB |
Output is correct |
4 |
Correct |
85 ms |
59396 KB |
Output is correct |
5 |
Correct |
68 ms |
59312 KB |
Output is correct |
6 |
Correct |
72 ms |
59440 KB |
Output is correct |
7 |
Correct |
20 ms |
1328 KB |
Output is correct |
8 |
Runtime error |
199 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |