# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725031 | 2023-04-16T13:25:15 Z | josanneo22 | Inside information (BOI21_servers) | C++17 | 105 ms | 196828 KB |
#include<bits/stdc++.h> using namespace std; #define int long long inline int rd(){ int x=0,w=1; char ch=getchar(); for(;ch>'9'||ch<'0';ch=getchar()) if(ch=='-') w=-1; for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0'; return x*w; } int maxn=5000; vector<vector<int>> st(maxn,vector<int>(maxn)); void solve(){ int n,q; cin>>n>>q; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ st[i][j]=0; } } for(int i=1;i<=n;i++){ st[i][i]=1; } for(int i=0;i<n+q-1;i++){ char x; cin>>x; if(x=='C'){ int v; cin>>v; int cnt=0; for(int j=1;j<=n;j++){ if(st[j][v]==1) cnt++; } cout<<cnt<<'\n'; } else if(x=='Q'){ int u,v; cin>>u>>v; if(st[u][v]) cout<<"yes\n"; else cout<<"no\n"; } else{ int u,v; cin>>u>>v; for(auto&p:st[u]) st[v][p]=1; for(auto&p:st[v]) st[u][v]=1; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int tt=1; //cin>>tt; while(tt--){ solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 99 ms | 196812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 99 ms | 196812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 101 ms | 196828 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 101 ms | 196828 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 101 ms | 196760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 101 ms | 196760 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 98 ms | 196708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 98 ms | 196708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 105 ms | 196788 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 105 ms | 196788 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 100 ms | 196716 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 100 ms | 196716 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |