# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639551 | 2022-09-10T15:23:36 Z | Benmath | Inside information (BOI21_servers) | C++14 | 241 ms | 716 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{ map<int,int>mapa; int ro=-1; int t1=0; while(x>0){ mapa[x]++; if(par1[x]<ro or par1[x]==-1){ 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 | 220 ms | 716 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 220 ms | 716 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 218 ms | 708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 218 ms | 708 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 241 ms | 568 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 241 ms | 568 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 234 ms | 636 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 234 ms | 636 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 234 ms | 668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 234 ms | 668 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 222 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 222 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |