제출 #863506

#제출 시각아이디문제언어결과실행 시간메모리
863506HossamHero7Inside information (BOI21_servers)C++14
5 / 100
194 ms524288 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' void solve(){ int n,q; cin>>n>>q; vector<vector<bool>> vis(n+1,vector<bool>(n+1)); 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'){ for(int j=1;j<=n;j++){ cnt[j] += vis[a][j] ^ vis[b][j]; vis[a][j] = vis[a][j] | vis[b][j]; } vis[b] = vis[a]; } else if(c == 'C') cout<<cnt[a]<<endl; 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 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...