Submission #812172

# Submission time Handle Problem Language Result Execution time Memory
812172 2023-08-07T07:36:41 Z MyCode Inside information (BOI21_servers) C++17
5 / 100
1315 ms 524288 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int n, k;
    cin >> n >> k;
    set<int> st[n + 1];
    for (int i = 1; i <= n; i++)
        st[i].insert(i);
    int cnt[n + 1];
    for (int i = 1; i <= n; i++)
        cnt[i] = 1;
    for (int q = 0; q < n + k - 1; q++) {
        char t;
        cin >> t;
        if (t == 'S') {
            int a, b;
            cin >> a >> b;
            for (auto x: st[b])
                if (st[a].find(x) == st[a].end())cnt[x]++;
            for (auto x: st[a])
                if (st[b].find(x) == st[b].end())cnt[x]++;
            for (auto x: st[b])
                st[a].insert(x);
            st[b] = st[a];
        } else if (t == 'Q') {
            int a, d;
            cin >> a >> d;
            if (st[a].find(d) == st[a].end())
                cout << "no\n";
            else
                cout << "yes\n";
        } else {
            int a;
            cin >> a;
            cout << cnt[a] << "\n";
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 15 ms 692 KB Output is correct
2 Correct 25 ms 3532 KB Output is correct
3 Correct 150 ms 49108 KB Output is correct
4 Correct 24 ms 3276 KB Output is correct
5 Correct 29 ms 3276 KB Output is correct
6 Correct 1098 ms 378208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 692 KB Output is correct
2 Correct 25 ms 3532 KB Output is correct
3 Correct 150 ms 49108 KB Output is correct
4 Correct 24 ms 3276 KB Output is correct
5 Correct 29 ms 3276 KB Output is correct
6 Correct 1098 ms 378208 KB Output is correct
7 Correct 17 ms 1492 KB Output is correct
8 Correct 22 ms 3164 KB Output is correct
9 Correct 161 ms 60896 KB Output is correct
10 Correct 22 ms 2900 KB Output is correct
11 Correct 21 ms 2676 KB Output is correct
12 Correct 1033 ms 378124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 724 KB Output is correct
2 Runtime error 1315 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 724 KB Output is correct
2 Runtime error 1315 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 596 KB Output is correct
2 Correct 137 ms 35600 KB Output is correct
3 Correct 143 ms 35576 KB Output is correct
4 Runtime error 989 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 596 KB Output is correct
2 Correct 137 ms 35600 KB Output is correct
3 Correct 143 ms 35576 KB Output is correct
4 Runtime error 989 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 656 KB Output is correct
2 Runtime error 565 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 656 KB Output is correct
2 Runtime error 565 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 628 KB Output is correct
2 Correct 138 ms 35648 KB Output is correct
3 Correct 132 ms 35608 KB Output is correct
4 Runtime error 992 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 628 KB Output is correct
2 Correct 138 ms 35648 KB Output is correct
3 Correct 132 ms 35608 KB Output is correct
4 Runtime error 992 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 596 KB Output is correct
2 Correct 25 ms 3532 KB Output is correct
3 Correct 152 ms 49008 KB Output is correct
4 Correct 24 ms 3300 KB Output is correct
5 Correct 28 ms 3112 KB Output is correct
6 Correct 1072 ms 378224 KB Output is correct
7 Correct 16 ms 1620 KB Output is correct
8 Runtime error 1296 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 596 KB Output is correct
2 Correct 25 ms 3532 KB Output is correct
3 Correct 152 ms 49008 KB Output is correct
4 Correct 24 ms 3300 KB Output is correct
5 Correct 28 ms 3112 KB Output is correct
6 Correct 1072 ms 378224 KB Output is correct
7 Correct 16 ms 1620 KB Output is correct
8 Runtime error 1296 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -