답안 #446877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446877 2021-07-23T16:13:45 Z wiwiho Inside information (BOI21_servers) C++14
5 / 100
442 ms 3944 KB
#include <bits/stdc++.h>

#define eb emplace_back
#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;

using pii = pair<int, int>;

int n, k;
const int SZ = 4001;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> k; 
    assert(n < SZ);
    vector<bitset<SZ>> b(n + 1);
    for(int i = 1; i <= n; i++) b[i].set(i);

    int q = n + k - 1;
    while(q--){

        string s;
        cin >> s;
        if(s == "S"){
            int u, v;
            cin >> u >> v;
            b[u] |= b[v];
            b[v] |= b[u];
        }
        else if(s == "Q"){
            int a, d;
            cin >> a >> d;
            if(b[a][d]) cout << "yes\n";
            else cout << "no\n";
        }
        else{
            int d;
            cin >> d;
            int ans = 0;
            for(int i = 1; i <= n; i++){
                if(b[i][d]) ans++;
            }
            cout << ans << "\n";
        }

    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 684 KB Output is correct
2 Correct 44 ms 2548 KB Output is correct
3 Correct 43 ms 2584 KB Output is correct
4 Correct 45 ms 2632 KB Output is correct
5 Correct 46 ms 2632 KB Output is correct
6 Correct 46 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 684 KB Output is correct
2 Correct 44 ms 2548 KB Output is correct
3 Correct 43 ms 2584 KB Output is correct
4 Correct 45 ms 2632 KB Output is correct
5 Correct 46 ms 2632 KB Output is correct
6 Correct 46 ms 2680 KB Output is correct
7 Correct 35 ms 1328 KB Output is correct
8 Correct 442 ms 3736 KB Output is correct
9 Correct 359 ms 3720 KB Output is correct
10 Correct 396 ms 3580 KB Output is correct
11 Correct 400 ms 3624 KB Output is correct
12 Correct 315 ms 3944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 604 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 604 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 664 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 664 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 592 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 592 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 632 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 632 KB Output is correct
2 Runtime error 1 ms 460 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 664 KB Output is correct
2 Correct 43 ms 2628 KB Output is correct
3 Correct 43 ms 2692 KB Output is correct
4 Correct 47 ms 2628 KB Output is correct
5 Correct 46 ms 2600 KB Output is correct
6 Correct 45 ms 2632 KB Output is correct
7 Correct 35 ms 728 KB Output is correct
8 Runtime error 1 ms 460 KB Execution killed with signal 6
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 664 KB Output is correct
2 Correct 43 ms 2628 KB Output is correct
3 Correct 43 ms 2692 KB Output is correct
4 Correct 47 ms 2628 KB Output is correct
5 Correct 46 ms 2600 KB Output is correct
6 Correct 45 ms 2632 KB Output is correct
7 Correct 35 ms 728 KB Output is correct
8 Runtime error 1 ms 460 KB Execution killed with signal 6
9 Halted 0 ms 0 KB -