#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
bitset<120001> vis[120001];
void solve(){
int n,q;
cin>>n>>q;
for(int i=1;i<=n;i++) vis[i][i] = 1;
vector<int> cnt(n+1,1);
for(int qq=0;qq<n+q-1;qq++){
char c;
int a,b;
cin>>c>>a;
if(c != 'C') cin>>b;
if(c == 'S'){
vis[a] |= vis[b];
vis[b] = vis[a];
}
else cout<<(vis[a][b] ? "yes" : "no")<<endl;
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
2908 KB |
Output is correct |
2 |
Correct |
35 ms |
60484 KB |
Output is correct |
3 |
Correct |
32 ms |
60512 KB |
Output is correct |
4 |
Correct |
35 ms |
60496 KB |
Output is correct |
5 |
Correct |
44 ms |
60468 KB |
Output is correct |
6 |
Correct |
34 ms |
60500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
2908 KB |
Output is correct |
2 |
Correct |
35 ms |
60484 KB |
Output is correct |
3 |
Correct |
32 ms |
60512 KB |
Output is correct |
4 |
Correct |
35 ms |
60496 KB |
Output is correct |
5 |
Correct |
44 ms |
60468 KB |
Output is correct |
6 |
Correct |
34 ms |
60500 KB |
Output is correct |
7 |
Incorrect |
16 ms |
2908 KB |
Extra information in the output file |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
2948 KB |
Output is correct |
2 |
Runtime error |
88 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
2948 KB |
Output is correct |
2 |
Runtime error |
88 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
82 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
82 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
83 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
83 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
78 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
78 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
3628 KB |
Output is correct |
2 |
Correct |
36 ms |
60496 KB |
Output is correct |
3 |
Correct |
41 ms |
60496 KB |
Output is correct |
4 |
Correct |
43 ms |
60300 KB |
Output is correct |
5 |
Correct |
37 ms |
60496 KB |
Output is correct |
6 |
Correct |
41 ms |
60544 KB |
Output is correct |
7 |
Correct |
15 ms |
2904 KB |
Output is correct |
8 |
Runtime error |
83 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
3628 KB |
Output is correct |
2 |
Correct |
36 ms |
60496 KB |
Output is correct |
3 |
Correct |
41 ms |
60496 KB |
Output is correct |
4 |
Correct |
43 ms |
60300 KB |
Output is correct |
5 |
Correct |
37 ms |
60496 KB |
Output is correct |
6 |
Correct |
41 ms |
60544 KB |
Output is correct |
7 |
Correct |
15 ms |
2904 KB |
Output is correct |
8 |
Runtime error |
83 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |