# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639534 | 2022-09-10T13:47:16 Z | Benmath | Inside information (BOI21_servers) | C++14 | 213 ms | 11536 KB |
#include <bits/stdc++.h> using namespace std; int bo[120001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,k; cin>>n>>k; int brojac=1; vector<pair<int,int> > adjl[n+2]; for(int k1=0;k1<(n+k-1);k1++){ char l; cin>>l; if(l=='S'){ int x,y; cin>>x>>y; if(x==1){ bo[y]++; } if(y==1){ bo[x]++; } adjl[x].push_back({y,brojac}); adjl[y].push_back({x,brojac}); brojac++; }else if (l=='Q'){ int y,x; cin>>y>>x; if(x==1){ if(bo[y]>0){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } }else if(y==1){ if(adjl[x].size()>0){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } }else{ if(adjl[x].size()>0 and adjl[y].size()>0){ int r1=adjl[x][0].second; int r2=adjl[y][0].second; if(r1<r2){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } }else{ cout<<"no"<<endl; } } }else{ int x; cin>>x; int ans=0; if(x==1){ cout<<brojac<<endl; }else{ if(adjl[x].size()>0){ int r1=adjl[x][0].second; cout<<brojac-r1+1<<endl; }else{ cout<<1<<endl; } } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 172 ms | 1556 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 172 ms | 1556 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 157 ms | 1492 KB | Output is correct |
2 | Incorrect | 213 ms | 11536 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 157 ms | 1492 KB | Output is correct |
2 | Incorrect | 213 ms | 11536 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 178 ms | 1592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 178 ms | 1592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 160 ms | 1512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 160 ms | 1512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 178 ms | 1724 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 178 ms | 1724 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 201 ms | 1496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 201 ms | 1496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |