Submission #812178

# Submission time Handle Problem Language Result Execution time Memory
812178 2023-08-07T07:40:42 Z MyCode Inside information (BOI21_servers) C++17
5 / 100
1353 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;
            if (a > n)
                cout << "0\n";
            else
                cout << cnt[a] << "\n";
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 596 KB Output is correct
2 Correct 25 ms 2140 KB Output is correct
3 Correct 154 ms 47672 KB Output is correct
4 Correct 24 ms 1876 KB Output is correct
5 Correct 23 ms 1704 KB Output is correct
6 Correct 1107 ms 376860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 596 KB Output is correct
2 Correct 25 ms 2140 KB Output is correct
3 Correct 154 ms 47672 KB Output is correct
4 Correct 24 ms 1876 KB Output is correct
5 Correct 23 ms 1704 KB Output is correct
6 Correct 1107 ms 376860 KB Output is correct
7 Correct 16 ms 584 KB Output is correct
8 Correct 23 ms 2164 KB Output is correct
9 Correct 162 ms 59844 KB Output is correct
10 Correct 22 ms 1832 KB Output is correct
11 Correct 22 ms 1640 KB Output is correct
12 Correct 1058 ms 376988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 724 KB Output is correct
2 Runtime error 1353 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 724 KB Output is correct
2 Runtime error 1353 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 596 KB Output is correct
2 Correct 133 ms 32312 KB Output is correct
3 Correct 136 ms 32328 KB Output is correct
4 Runtime error 1000 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 596 KB Output is correct
2 Correct 133 ms 32312 KB Output is correct
3 Correct 136 ms 32328 KB Output is correct
4 Runtime error 1000 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 588 KB Output is correct
2 Runtime error 578 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 588 KB Output is correct
2 Runtime error 578 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 150 ms 32236 KB Output is correct
3 Correct 152 ms 32224 KB Output is correct
4 Runtime error 1004 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 150 ms 32236 KB Output is correct
3 Correct 152 ms 32224 KB Output is correct
4 Runtime error 1004 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 612 KB Output is correct
2 Correct 25 ms 2180 KB Output is correct
3 Correct 149 ms 47680 KB Output is correct
4 Correct 24 ms 1812 KB Output is correct
5 Correct 23 ms 1676 KB Output is correct
6 Correct 1105 ms 376948 KB Output is correct
7 Correct 17 ms 724 KB Output is correct
8 Runtime error 1313 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 612 KB Output is correct
2 Correct 25 ms 2180 KB Output is correct
3 Correct 149 ms 47680 KB Output is correct
4 Correct 24 ms 1812 KB Output is correct
5 Correct 23 ms 1676 KB Output is correct
6 Correct 1105 ms 376948 KB Output is correct
7 Correct 17 ms 724 KB Output is correct
8 Runtime error 1313 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -