Submission #850701

#TimeUsernameProblemLanguageResultExecution timeMemory
850701d4xnInside information (BOI21_servers)C++17
5 / 100
2560 ms524288 KiB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma") #include <bits/stdc++.h> using namespace std; const int N = 5e4; int n, k; bitset<N> bt[N]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> k; for (int i = 0; i < n; i++) { bt[i][i] = 1; } for (int i = 0; i < n+k-1; i++) { char tp; cin >> tp; if (tp == 'S') { int x, y; cin >> x >> y; x--; y--; // bt[x] = bt[y] = (bt[x] | bt[y]); bt[x] |= bt[y]; bt[y] |= bt[x]; } else if (tp == 'Q') { int x, z; cin >> x >> z; x--; z--; if (bt[x][z]) cout << "yes\n"; else cout << "no\n"; } else { int z; cin >> z; z--; int ans = 0; for (int i = 0; i < n; i++) { if (bt[i][z]) ans++; } cout << ans << "\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...