Submission #657573

#TimeUsernameProblemLanguageResultExecution timeMemory
657573TimDeeInside information (BOI21_servers)C++17
2.50 / 100
2697 ms524288 KiB
#include <bits/stdc++.h> using namespace std; #define forn(i,n) for (int i=0; i<n; ++i) void solve() { int n,q; cin>>n>>q; vector<set<int>> a(n+1); forn(i,n) a[i+1].insert(i+1); forn(Q,n-1+q) { char c; cin>>c; if (c=='S') { int u,v; cin>>u>>v; for (auto x:a[u]) a[v].insert(x); for (auto x:a[v]) a[u].insert(x); } else if (c=='Q') { int u,x; cin>>u>>x; cout << (a[u].count(x)?"yes\n":"no\n"); } else { cout<<"0\n"; } } } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...