#include <bits/stdc++.h>
#define eb emplace_back
using namespace std;
typedef long long ll;
const int SZ = 120000;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, k;
cin >> n >> k;
vector<bitset<SZ>> b(n + 1);
for(int i = 1; i <= n; i++) b[i].set(i);
int q = n + k - 1;
while(q--){
string s;
cin >> s;
assert(s != "C");
if(s == "S"){
int u, v;
cin >> u >> v;
b[u] |= b[v];
b[v] |= b[u];
continue;
}
int v, c;
cin >> v >> c;
if(b[v][c]) cout << "yes\n";
else cout << "no\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2244 KB |
Output is correct |
2 |
Correct |
93 ms |
60680 KB |
Output is correct |
3 |
Correct |
82 ms |
60708 KB |
Output is correct |
4 |
Correct |
94 ms |
60720 KB |
Output is correct |
5 |
Correct |
93 ms |
60712 KB |
Output is correct |
6 |
Correct |
88 ms |
60788 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2244 KB |
Output is correct |
2 |
Correct |
93 ms |
60680 KB |
Output is correct |
3 |
Correct |
82 ms |
60708 KB |
Output is correct |
4 |
Correct |
94 ms |
60720 KB |
Output is correct |
5 |
Correct |
93 ms |
60712 KB |
Output is correct |
6 |
Correct |
88 ms |
60788 KB |
Output is correct |
7 |
Runtime error |
3 ms |
1996 KB |
Execution killed with signal 6 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
2252 KB |
Output is correct |
2 |
Runtime error |
218 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
2252 KB |
Output is correct |
2 |
Runtime error |
218 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
2240 KB |
Output is correct |
2 |
Runtime error |
210 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
2240 KB |
Output is correct |
2 |
Runtime error |
210 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
2180 KB |
Output is correct |
2 |
Runtime error |
214 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
2180 KB |
Output is correct |
2 |
Runtime error |
214 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2228 KB |
Output is correct |
2 |
Runtime error |
209 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2228 KB |
Output is correct |
2 |
Runtime error |
209 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2240 KB |
Output is correct |
2 |
Correct |
96 ms |
60656 KB |
Output is correct |
3 |
Correct |
81 ms |
60740 KB |
Output is correct |
4 |
Correct |
97 ms |
60760 KB |
Output is correct |
5 |
Correct |
93 ms |
60688 KB |
Output is correct |
6 |
Correct |
90 ms |
60996 KB |
Output is correct |
7 |
Correct |
35 ms |
2244 KB |
Output is correct |
8 |
Runtime error |
214 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
2240 KB |
Output is correct |
2 |
Correct |
96 ms |
60656 KB |
Output is correct |
3 |
Correct |
81 ms |
60740 KB |
Output is correct |
4 |
Correct |
97 ms |
60760 KB |
Output is correct |
5 |
Correct |
93 ms |
60688 KB |
Output is correct |
6 |
Correct |
90 ms |
60996 KB |
Output is correct |
7 |
Correct |
35 ms |
2244 KB |
Output is correct |
8 |
Runtime error |
214 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |