Submission #489156

# Submission time Handle Problem Language Result Execution time Memory
489156 2021-11-21T10:21:20 Z PiejanVDC Inside information (BOI21_servers) C++17
2.5 / 100
3500 ms 524292 KB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    int n,k; cin>>n>>k;
    vector<set<int>>v(n);
    for(int i = 0 ; i < n ; i++)
        v[i].insert(i);
    for(int i = 0 ; i < n+k-1 ; i++) {
        char c; cin>>c;
        if(c == 'S') {
            int a,b; cin>>a>>b;
            a--,b--;
            if(v[a].size() < v[b].size()) swap(v[a],v[b]);
            for(auto it = v[b].begin() ; it != v[b].end() ; it++) {
                v[a].insert(*it);
            }
            v[b] = v[a];
        } else if(c == 'Q') {
            int a,d; cin>>a>>d;
            a--,d--;
            if(v[a].count(d)) {
                cout << "yes\n";
            } else cout << "no\n";
        } else {
            int d; cin>>d;
            d--;
            int cnt=0;
            for(auto z : v)
                if(z.count(d)) cnt++;
            cout << cnt << "\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 183 ms 1320 KB Output is correct
2 Correct 216 ms 2840 KB Output is correct
3 Correct 335 ms 48224 KB Output is correct
4 Correct 206 ms 2276 KB Output is correct
5 Correct 217 ms 2356 KB Output is correct
6 Correct 813 ms 377436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 1320 KB Output is correct
2 Correct 216 ms 2840 KB Output is correct
3 Correct 335 ms 48224 KB Output is correct
4 Correct 206 ms 2276 KB Output is correct
5 Correct 217 ms 2356 KB Output is correct
6 Correct 813 ms 377436 KB Output is correct
7 Correct 275 ms 1080 KB Output is correct
8 Execution timed out 3569 ms 1616 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 201 ms 1576 KB Output is correct
2 Runtime error 535 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 201 ms 1576 KB Output is correct
2 Runtime error 535 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 182 ms 1500 KB Output is correct
2 Correct 416 ms 33116 KB Output is correct
3 Correct 391 ms 33040 KB Output is correct
4 Runtime error 890 ms 524292 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Correct 182 ms 1500 KB Output is correct
2 Correct 416 ms 33116 KB Output is correct
3 Correct 391 ms 33040 KB Output is correct
4 Runtime error 890 ms 524292 KB Execution killed with signal 9
# Verdict Execution time Memory Grader output
1 Correct 183 ms 1456 KB Output is correct
2 Runtime error 603 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 183 ms 1456 KB Output is correct
2 Runtime error 603 ms 524292 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 202 ms 1644 KB Output is correct
2 Correct 452 ms 33036 KB Output is correct
3 Correct 415 ms 33132 KB Output is correct
4 Runtime error 863 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 202 ms 1644 KB Output is correct
2 Correct 452 ms 33036 KB Output is correct
3 Correct 415 ms 33132 KB Output is correct
4 Runtime error 863 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 186 ms 1436 KB Output is correct
2 Correct 213 ms 2680 KB Output is correct
3 Correct 342 ms 48172 KB Output is correct
4 Correct 201 ms 2268 KB Output is correct
5 Correct 208 ms 2140 KB Output is correct
6 Correct 760 ms 377400 KB Output is correct
7 Correct 190 ms 1268 KB Output is correct
8 Runtime error 490 ms 524292 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 186 ms 1436 KB Output is correct
2 Correct 213 ms 2680 KB Output is correct
3 Correct 342 ms 48172 KB Output is correct
4 Correct 201 ms 2268 KB Output is correct
5 Correct 208 ms 2140 KB Output is correct
6 Correct 760 ms 377400 KB Output is correct
7 Correct 190 ms 1268 KB Output is correct
8 Runtime error 490 ms 524292 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -