Submission #554354

#TimeUsernameProblemLanguageResultExecution timeMemory
554354Jarif_RahmanInside information (BOI21_servers)C++17
2.50 / 100
1500 ms524288 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; q+=n-1; vector<set<int>> v(n); for(int i = 0; i < n; i++) v[i].insert(i); while(q--){ str tt; int a, b; cin >> tt >> a >> b; a--, b--; if(tt == "S"){ for(int x: v[b]) v[a].insert(x); v[b] = v[a]; } else{ cout << (v[a].find(b) != v[a].end() ? "yes":"no") << "\n"; } } }
#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...