# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
902613 | 2024-01-10T20:32:28 Z | simona1230 | Inside information (BOI21_servers) | C++17 | 177 ms | 2936 KB |
#include <bits/stdc++.h> using namespace std; int n,k; int in[4001][4001]; void slow() { for(int i=1;i<=n;i++) in[i][i]=1; for(int i=1;i<=n+k-1;i++) { char c; cin>>c; int x,y; if(c=='S') { cin>>x>>y; for(int j=1;j<=n;j++) { in[x][j]=in[y][j]=max(in[x][j],in[y][j]); } } if(c=='C') { cin>>x; int cnt=0; for(int j=1;j<=n;j++) cnt+=in[j][x]; cout<<cnt<<endl; } if(c=='Q') { cin>>x>>y; if(in[x][y])cout<<"yes"<<endl; else cout<<"no"<<endl; } } } int t[120001]; void subt2() { t[1]=1; int sec=1; for(int i=1;i<=n+k-1;i++) { char c; cin>>c; if(c=='S') { int x,y; cin>>x>>y; t[max(x,y)]=sec++; } if(c=='Q') { int x,y; cin>>x>>y; if(t[y]&&t[y]<t[x]||x==1&&t[y]||y==1&&t[x])cout<<"yes"<<endl; else cout<<"no"<<endl; } if(c=='C') { int x; cin>>x; if(t[x]==0)cout<<1<<endl; else cout<<sec-t[x]+1<<endl; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n>>k; /*if(n<=4000)slow(); else */subt2(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 146 ms | 660 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 146 ms | 660 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 151 ms | 872 KB | Output is correct |
2 | Incorrect | 177 ms | 2936 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 151 ms | 872 KB | Output is correct |
2 | Incorrect | 177 ms | 2936 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 158 ms | 812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 158 ms | 812 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 164 ms | 592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 164 ms | 592 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 174 ms | 728 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 174 ms | 728 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 148 ms | 1008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 148 ms | 1008 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |