Submission #846799

# Submission time Handle Problem Language Result Execution time Memory
846799 2023-09-08T12:56:27 Z Ahmed57 Inside information (BOI21_servers) C++17
0 / 100
171 ms 1000 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,q;cin>>n>>q;
    q+=n-1;
    int mer[n+1];
    for(int i = 1;i<=n;i++)mer[i] = -1;
    int ind = 0;
    while(q--){
        char c;cin>>c;
        if(c=='S'){
            int a,b;cin>>a>>b;
            if(a>b)swap(a,b);
            mer[b] = ind;ind++;
        }if(c=='C'){
            int a;cin>>a;
            if(mer[a]==-1)cout<<1<<endl;
            else cout<<1+ind-mer[a]<<endl;
        }if(c=='Q'){
            int a,b;cin>>a>>b;
            if(b==1){
                if(a==1||mer[a]!=-1)cout<<"yes\n";
                else cout<<"no\n";
                continue;
            }
            if(a==b)cout<<"yes\n";
            else{
                if(a==1&&mer[b]==-1)cout<<"no\n";
                else if(a!=1&&mer[a]>mer[b])cout<<"no\n";
                else cout<<"yes\n";
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 1000 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 168 ms 1000 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 780 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 836 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 836 KB Output isn't correct
2 Halted 0 ms 0 KB -