#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=0;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;
a --;
if(c != 'C') cin>>b, 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2908 KB |
Output is correct |
2 |
Correct |
38 ms |
60504 KB |
Output is correct |
3 |
Correct |
31 ms |
60508 KB |
Output is correct |
4 |
Correct |
35 ms |
60508 KB |
Output is correct |
5 |
Correct |
33 ms |
60496 KB |
Output is correct |
6 |
Correct |
31 ms |
60508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2908 KB |
Output is correct |
2 |
Correct |
38 ms |
60504 KB |
Output is correct |
3 |
Correct |
31 ms |
60508 KB |
Output is correct |
4 |
Correct |
35 ms |
60508 KB |
Output is correct |
5 |
Correct |
33 ms |
60496 KB |
Output is correct |
6 |
Correct |
31 ms |
60508 KB |
Output is correct |
7 |
Incorrect |
15 ms |
2908 KB |
Extra information in the output file |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
79 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
79 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
3160 KB |
Output is correct |
2 |
Runtime error |
81 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
3160 KB |
Output is correct |
2 |
Runtime error |
81 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
78 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
78 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
78 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2904 KB |
Output is correct |
2 |
Runtime error |
78 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
2904 KB |
Output is correct |
2 |
Correct |
43 ms |
60440 KB |
Output is correct |
3 |
Correct |
32 ms |
60496 KB |
Output is correct |
4 |
Correct |
42 ms |
60496 KB |
Output is correct |
5 |
Correct |
33 ms |
60496 KB |
Output is correct |
6 |
Correct |
35 ms |
60524 KB |
Output is correct |
7 |
Correct |
15 ms |
2908 KB |
Output is correct |
8 |
Runtime error |
77 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
2904 KB |
Output is correct |
2 |
Correct |
43 ms |
60440 KB |
Output is correct |
3 |
Correct |
32 ms |
60496 KB |
Output is correct |
4 |
Correct |
42 ms |
60496 KB |
Output is correct |
5 |
Correct |
33 ms |
60496 KB |
Output is correct |
6 |
Correct |
35 ms |
60524 KB |
Output is correct |
7 |
Correct |
15 ms |
2908 KB |
Output is correct |
8 |
Runtime error |
77 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Halted |
0 ms |
0 KB |
- |