답안 #726950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
726950 2023-04-19T16:34:55 Z vjudge1 게임 (APIO22_game) C++17
30 / 100
1781 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
#include "game.h"

int N, K;
int f[300000];
vector<int> adj[300000], radj[300000];

void init(int n, int k) {
        N = n, K = k;
        for (int i = 0; i < N; i++) f[i] = N;
}

priority_queue<pair<int, int>> pq[300000];

int add_teleporter(int u, int v) {
        adj[u].emplace_back(v);
        radj[v].emplace_back(u);
        pq[v].emplace(f[u], u);
        int F = v < K ? v : f[v];
        queue<int> q;
        q.emplace(v);
        while (q.size()) {
                int v = q.front();
                q.pop();
                while (pq[v].size()) {
                        auto [fu, u] = pq[v].top();
                        if (fu <= F) break;
                        pq[v].pop();
                        if (f[u] != fu) {
                                f[u] = min(f[u], F);
                                pq[v].emplace(f[u], u);
                        }
                        f[u] = F;
                        pq[v].emplace(f[u], u);
                        q.emplace(u);
                }
        }
        for (int i = 0; i < K; i++) {
                if (f[i] <= i) return 1;
        }
        return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23760 KB Output is correct
2 Correct 12 ms 23760 KB Output is correct
3 Correct 13 ms 23708 KB Output is correct
4 Correct 12 ms 23728 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 13 ms 23796 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23760 KB Output is correct
2 Correct 12 ms 23760 KB Output is correct
3 Correct 13 ms 23708 KB Output is correct
4 Correct 12 ms 23728 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 13 ms 23796 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23780 KB Output is correct
9 Correct 12 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 12 ms 23760 KB Output is correct
12 Correct 11 ms 23716 KB Output is correct
13 Correct 15 ms 23760 KB Output is correct
14 Correct 15 ms 23676 KB Output is correct
15 Correct 14 ms 23760 KB Output is correct
16 Correct 13 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23796 KB Output is correct
19 Correct 14 ms 23760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23760 KB Output is correct
2 Correct 12 ms 23760 KB Output is correct
3 Correct 13 ms 23708 KB Output is correct
4 Correct 12 ms 23728 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 13 ms 23796 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23780 KB Output is correct
9 Correct 12 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 12 ms 23760 KB Output is correct
12 Correct 11 ms 23716 KB Output is correct
13 Correct 15 ms 23760 KB Output is correct
14 Correct 15 ms 23676 KB Output is correct
15 Correct 14 ms 23760 KB Output is correct
16 Correct 13 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23796 KB Output is correct
19 Correct 14 ms 23760 KB Output is correct
20 Correct 13 ms 23820 KB Output is correct
21 Correct 12 ms 23712 KB Output is correct
22 Correct 13 ms 23760 KB Output is correct
23 Correct 13 ms 23760 KB Output is correct
24 Correct 20 ms 23760 KB Output is correct
25 Correct 17 ms 23888 KB Output is correct
26 Correct 15 ms 23888 KB Output is correct
27 Correct 16 ms 23888 KB Output is correct
28 Correct 14 ms 23760 KB Output is correct
29 Correct 20 ms 23888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23760 KB Output is correct
2 Correct 12 ms 23760 KB Output is correct
3 Correct 13 ms 23708 KB Output is correct
4 Correct 12 ms 23728 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 13 ms 23796 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23780 KB Output is correct
9 Correct 12 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 12 ms 23760 KB Output is correct
12 Correct 11 ms 23716 KB Output is correct
13 Correct 15 ms 23760 KB Output is correct
14 Correct 15 ms 23676 KB Output is correct
15 Correct 14 ms 23760 KB Output is correct
16 Correct 13 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23796 KB Output is correct
19 Correct 14 ms 23760 KB Output is correct
20 Correct 13 ms 23820 KB Output is correct
21 Correct 12 ms 23712 KB Output is correct
22 Correct 13 ms 23760 KB Output is correct
23 Correct 13 ms 23760 KB Output is correct
24 Correct 20 ms 23760 KB Output is correct
25 Correct 17 ms 23888 KB Output is correct
26 Correct 15 ms 23888 KB Output is correct
27 Correct 16 ms 23888 KB Output is correct
28 Correct 14 ms 23760 KB Output is correct
29 Correct 20 ms 23888 KB Output is correct
30 Correct 42 ms 25580 KB Output is correct
31 Correct 20 ms 24484 KB Output is correct
32 Correct 47 ms 26688 KB Output is correct
33 Correct 39 ms 26584 KB Output is correct
34 Correct 956 ms 26676 KB Output is correct
35 Correct 349 ms 27076 KB Output is correct
36 Correct 83 ms 27044 KB Output is correct
37 Correct 77 ms 26968 KB Output is correct
38 Correct 79 ms 26588 KB Output is correct
39 Correct 73 ms 26732 KB Output is correct
40 Correct 1208 ms 27192 KB Output is correct
41 Correct 177 ms 26668 KB Output is correct
42 Correct 161 ms 26516 KB Output is correct
43 Correct 102 ms 27320 KB Output is correct
44 Runtime error 1781 ms 262144 KB Execution killed with signal 9
45 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23760 KB Output is correct
2 Correct 12 ms 23760 KB Output is correct
3 Correct 13 ms 23708 KB Output is correct
4 Correct 12 ms 23728 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 13 ms 23796 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23780 KB Output is correct
9 Correct 12 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 12 ms 23760 KB Output is correct
12 Correct 11 ms 23716 KB Output is correct
13 Correct 15 ms 23760 KB Output is correct
14 Correct 15 ms 23676 KB Output is correct
15 Correct 14 ms 23760 KB Output is correct
16 Correct 13 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23796 KB Output is correct
19 Correct 14 ms 23760 KB Output is correct
20 Correct 13 ms 23820 KB Output is correct
21 Correct 12 ms 23712 KB Output is correct
22 Correct 13 ms 23760 KB Output is correct
23 Correct 13 ms 23760 KB Output is correct
24 Correct 20 ms 23760 KB Output is correct
25 Correct 17 ms 23888 KB Output is correct
26 Correct 15 ms 23888 KB Output is correct
27 Correct 16 ms 23888 KB Output is correct
28 Correct 14 ms 23760 KB Output is correct
29 Correct 20 ms 23888 KB Output is correct
30 Correct 42 ms 25580 KB Output is correct
31 Correct 20 ms 24484 KB Output is correct
32 Correct 47 ms 26688 KB Output is correct
33 Correct 39 ms 26584 KB Output is correct
34 Correct 956 ms 26676 KB Output is correct
35 Correct 349 ms 27076 KB Output is correct
36 Correct 83 ms 27044 KB Output is correct
37 Correct 77 ms 26968 KB Output is correct
38 Correct 79 ms 26588 KB Output is correct
39 Correct 73 ms 26732 KB Output is correct
40 Correct 1208 ms 27192 KB Output is correct
41 Correct 177 ms 26668 KB Output is correct
42 Correct 161 ms 26516 KB Output is correct
43 Correct 102 ms 27320 KB Output is correct
44 Runtime error 1781 ms 262144 KB Execution killed with signal 9
45 Halted 0 ms 0 KB -