# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639546 | 2022-09-10T15:13:17 Z | Benmath | Inside information (BOI21_servers) | C++14 | 221 ms | 624 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; int brojac=1; int par[n+1]; int par1[n+1]; for(int i=0;i<=n;i++){ par[i]=-1; } for(int k1=0;k1<(n+k-1);k1++){ char l; cin>>l; if(l=='S'){ int x,y; cin>>x>>y; if(x>y){ swap(x,y); } par[y]=x; par1[y]=brojac; brojac++; }else if(l=='Q'){ int y,x; cin>>y>>x; if(x==y){ cout<<"yes"<<endl; }else if(x<y){ int ro=1e9; int t1=0; while(x<y){ if(par1[y]>ro or par1[y]==-1){ t1++; break; }else{ ro=par1[y]; y=y/2; } } if(x==y and t1==0){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } }else{ map<int,int>mapa; int ro=-1; int t1=0; while(x>0){ mapa[x]++; if(par1[x]<ro){ break; }else{ ro=par1[x]; x=x/2; } } ro=1e9; while(y>0){ if(mapa[y]>0){ t1++; break; } if(par1[y]>ro or par1[y]==-1){ break; }else{ ro=par1[y]; y=y/2; } } if(t1>0){ cout<<"yes"<<endl; }else{ cout<<"no"<<endl; } } }else{ } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 199 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 199 ms | 588 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 215 ms | 560 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 215 ms | 560 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 210 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 210 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 220 ms | 624 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 220 ms | 624 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 221 ms | 592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 221 ms | 592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 215 ms | 624 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 215 ms | 624 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |