Submission #899196

# Submission time Handle Problem Language Result Execution time Memory
899196 2024-01-05T15:17:54 Z AIF_is_carving Inside information (BOI21_servers) C++17
2.5 / 100
129 ms 6504 KB
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

const int N=2e5+5;
map<int, int> graph;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, k; cin>>n>>k;
    graph[1]=1;
    int count=1;

    for(int i=0; i<n+k-1; i++){
        char c; cin>>c;
        if(c=='S'){
            count+=1;
            int u, v; cin>>u>>v;
            graph[max(u,v)]=count;
        }
        else if(c=='Q'){
            int v, chunk; cin>>v>>chunk;
            if(graph[v]==0){
                if(v==chunk) cout<<"yes"<<"\n";
                else cout<<"no"<<"\n";
            }
            else{
                if(graph[chunk]==0) cout<<"no"<<"\n";
                else{
                    if(v==1 || graph[v]>=graph[chunk]) cout<<"yes"<<"\n";
                    else cout<<"no"<<"\n";
                }
            }
        }
        else{
            int chunk; cin>>chunk;
            if(graph[chunk]==0){
                cout<<1<<"\n";
            }
            else{
                if(chunk==1) cout<<graph.size()<<"\n";
                else cout<<graph.size()-graph[chunk]+2<<"\n";
            }
        }

 
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 648 KB Output is correct
2 Correct 121 ms 6504 KB Output is correct
3 Correct 129 ms 6368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 648 KB Output is correct
2 Correct 121 ms 6504 KB Output is correct
3 Correct 129 ms 6368 KB Output is correct
4 Incorrect 23 ms 604 KB Extra information in the output file
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 760 KB Output isn't correct
2 Halted 0 ms 0 KB -