Submission #899150

# Submission time Handle Problem Language Result Execution time Memory
899150 2024-01-05T14:18:13 Z AIF_is_carving Inside information (BOI21_servers) C++17
5 / 100
2228 ms 524288 KB
#include <bits/stdc++.h>
typedef long long ll;
 
using namespace std;
 
const int N=2e5+5;
set<int> graph[N];
int cnt[N];
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
 
 
    int n, k; cin>>n>>k;
 
    for(int i=1; i<=n; i++){
        graph[i].insert(i);
        cnt[i]=1;
    }
 
    for(int i=0; i<n+k-1; i++){
        char c; cin>>c;
        if(c=='S'){
            int u, v; cin>>u>>v;
            for(auto x: graph[v]){
                if(graph[u].find(x)==graph[u].end()){ 
                    cnt[x]+=1;
                    graph[u].insert(x);
                }
            }
            for(auto x: graph[u]){
                if(graph[v].find(x)==graph[v].end()){ 
                    cnt[x]+=1;
                    graph[v].insert(x);
                }
            }
        }
        else if(c=='Q'){
            int v, chunk ; cin>>v>>chunk;
            if(graph[v].find(chunk)==graph[v].end()){
                cout<<"no"<<"\n";
            }
            else{
                cout<<"yes"<<"\n";
            }  
        }
        else{
            int v; cin>>v;
            cout<<cnt[v]<<"\n";
        }
    }
 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 21 ms 10844 KB Output is correct
2 Correct 30 ms 13136 KB Output is correct
3 Correct 256 ms 58588 KB Output is correct
4 Correct 40 ms 12880 KB Output is correct
5 Correct 32 ms 12636 KB Output is correct
6 Correct 1752 ms 387412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 10844 KB Output is correct
2 Correct 30 ms 13136 KB Output is correct
3 Correct 256 ms 58588 KB Output is correct
4 Correct 40 ms 12880 KB Output is correct
5 Correct 32 ms 12636 KB Output is correct
6 Correct 1752 ms 387412 KB Output is correct
7 Correct 20 ms 10584 KB Output is correct
8 Correct 27 ms 11916 KB Output is correct
9 Correct 255 ms 69848 KB Output is correct
10 Correct 25 ms 11600 KB Output is correct
11 Correct 24 ms 11356 KB Output is correct
12 Correct 1659 ms 386948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 10872 KB Output is correct
2 Runtime error 2088 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 10872 KB Output is correct
2 Runtime error 2088 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 10588 KB Output is correct
2 Correct 154 ms 36180 KB Output is correct
3 Correct 140 ms 36016 KB Output is correct
4 Runtime error 1726 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 10588 KB Output is correct
2 Correct 154 ms 36180 KB Output is correct
3 Correct 140 ms 36016 KB Output is correct
4 Runtime error 1726 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 10584 KB Output is correct
2 Runtime error 2228 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 10584 KB Output is correct
2 Runtime error 2228 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 10840 KB Output is correct
2 Correct 141 ms 36044 KB Output is correct
3 Correct 163 ms 35920 KB Output is correct
4 Runtime error 1757 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 10840 KB Output is correct
2 Correct 141 ms 36044 KB Output is correct
3 Correct 163 ms 35920 KB Output is correct
4 Runtime error 1757 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 10612 KB Output is correct
2 Correct 31 ms 12000 KB Output is correct
3 Correct 248 ms 57452 KB Output is correct
4 Correct 40 ms 11604 KB Output is correct
5 Correct 27 ms 11504 KB Output is correct
6 Correct 1759 ms 386888 KB Output is correct
7 Correct 24 ms 10844 KB Output is correct
8 Runtime error 2054 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 10612 KB Output is correct
2 Correct 31 ms 12000 KB Output is correct
3 Correct 248 ms 57452 KB Output is correct
4 Correct 40 ms 11604 KB Output is correct
5 Correct 27 ms 11504 KB Output is correct
6 Correct 1759 ms 386888 KB Output is correct
7 Correct 24 ms 10844 KB Output is correct
8 Runtime error 2054 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -