Submission #963967

# Submission time Handle Problem Language Result Execution time Memory
963967 2024-04-16T06:03:54 Z Pring Inside information (BOI21_servers) C++17
2.5 / 100
1886 ms 378544 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3","unroll-loops")
#pragma GCC target("avx2","popcnt","sse4","abm")
using namespace std;

#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;
typedef array<int, 4> p4i;

const int MXN = 4005;
int n, q;
set<int> S[MXN];

void miku() {
    cin >> n >> q;
    FOR(i, 1, n + 1) S[i].insert(i);
    FOR(i, 0, n + q - 1) {
        char c;
        int a, b;
        cin >> c;
        if (c == 'S') {
            cin >> a >> b;
            vector<int> v;
            for (auto i : S[a]) v.push_back(i);
            for (auto i : S[b]) v.push_back(i);
            for (auto &i : v) {
                S[a].insert(i);
                S[b].insert(i);
            }
        } else if (c == 'Q') {
            cin >> a >> b;
            cout << (S[a].find(b) == S[a].end() ? "no" : "yes") << '\n';
        } else {
            cin >> a;
            cout << 0 << '\n';
        }
    }
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1872 KB Output is correct
2 Correct 27 ms 3480 KB Output is correct
3 Correct 229 ms 48992 KB Output is correct
4 Correct 30 ms 3508 KB Output is correct
5 Correct 26 ms 3204 KB Output is correct
6 Correct 1886 ms 378544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1872 KB Output is correct
2 Correct 27 ms 3480 KB Output is correct
3 Correct 229 ms 48992 KB Output is correct
4 Correct 30 ms 3508 KB Output is correct
5 Correct 26 ms 3204 KB Output is correct
6 Correct 1886 ms 378544 KB Output is correct
7 Incorrect 17 ms 1116 KB Extra information in the output file
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1956 KB Output is correct
2 Runtime error 2 ms 1368 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1956 KB Output is correct
2 Runtime error 2 ms 1368 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1760 KB Output is correct
2 Runtime error 2 ms 1372 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1760 KB Output is correct
2 Runtime error 2 ms 1372 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1884 KB Output is correct
2 Runtime error 1 ms 1372 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 1884 KB Output is correct
2 Runtime error 1 ms 1372 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1932 KB Output is correct
2 Runtime error 1 ms 1372 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1932 KB Output is correct
2 Runtime error 1 ms 1372 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1856 KB Output is correct
2 Correct 29 ms 3664 KB Output is correct
3 Correct 228 ms 49236 KB Output is correct
4 Correct 27 ms 3156 KB Output is correct
5 Correct 30 ms 3152 KB Output is correct
6 Correct 1778 ms 378540 KB Output is correct
7 Correct 18 ms 1872 KB Output is correct
8 Runtime error 2 ms 1368 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1856 KB Output is correct
2 Correct 29 ms 3664 KB Output is correct
3 Correct 228 ms 49236 KB Output is correct
4 Correct 27 ms 3156 KB Output is correct
5 Correct 30 ms 3152 KB Output is correct
6 Correct 1778 ms 378540 KB Output is correct
7 Correct 18 ms 1872 KB Output is correct
8 Runtime error 2 ms 1368 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -