Submission #816370

# Submission time Handle Problem Language Result Execution time Memory
816370 2023-08-09T04:55:32 Z 이동현(#10127) Game (APIO22_game) C++17
30 / 100
4000 ms 3968 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

int n, k;
int chk[30004];
vector<int> way[30004], wayb[30004];
int que[30004], f, r;
int chkn;

void init(int N, int K) {
    n = N, k = K;
    assert(n <= 30000 && k <= 1000);
}

int add_teleporter(int u, int v) {
    way[u].push_back(v);
    wayb[v].push_back(u);
    int mn = (int)1e9, mx = -1;
    f = r = 0;
    ++chkn;
    que[r++] = v, chk[v] = chkn;
    while(f < r){
        int now = que[f++];
        if(now < k) mn = min(mn, now);

        for(auto&nxt:way[now]){
            if(chkn != chk[nxt]){
                chk[nxt] = chkn;
                que[r++] = nxt;
            }
        }
    }

    ++chkn;
    f = r = 0;
    que[r++] = u, chk[u] = chkn;
    while(f < r){
        int now = que[f++];
        if(now < k) mx = max(mx, now);

        for(auto&nxt:wayb[now]){
            if(chkn != chk[nxt]){
                chk[nxt] = chkn;
                que[r++] = nxt;
            }
        }
    }

    return mn <= mx;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1708 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1708 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1708 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 1 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 4 ms 1744 KB Output is correct
25 Correct 7 ms 1744 KB Output is correct
26 Correct 22 ms 1812 KB Output is correct
27 Correct 3 ms 1748 KB Output is correct
28 Correct 2 ms 1744 KB Output is correct
29 Correct 3 ms 1776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1708 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 1 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 4 ms 1744 KB Output is correct
25 Correct 7 ms 1744 KB Output is correct
26 Correct 22 ms 1812 KB Output is correct
27 Correct 3 ms 1748 KB Output is correct
28 Correct 2 ms 1744 KB Output is correct
29 Correct 3 ms 1776 KB Output is correct
30 Correct 14 ms 2896 KB Output is correct
31 Correct 4 ms 2128 KB Output is correct
32 Correct 30 ms 3632 KB Output is correct
33 Correct 23 ms 3692 KB Output is correct
34 Correct 892 ms 3864 KB Output is correct
35 Correct 728 ms 3840 KB Output is correct
36 Correct 797 ms 3804 KB Output is correct
37 Correct 355 ms 3800 KB Output is correct
38 Correct 370 ms 3520 KB Output is correct
39 Correct 454 ms 3580 KB Output is correct
40 Correct 803 ms 3968 KB Output is correct
41 Correct 391 ms 3528 KB Output is correct
42 Correct 198 ms 3480 KB Output is correct
43 Execution timed out 4097 ms 3956 KB Time limit exceeded
44 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 1 ms 1708 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 1 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 4 ms 1744 KB Output is correct
25 Correct 7 ms 1744 KB Output is correct
26 Correct 22 ms 1812 KB Output is correct
27 Correct 3 ms 1748 KB Output is correct
28 Correct 2 ms 1744 KB Output is correct
29 Correct 3 ms 1776 KB Output is correct
30 Correct 14 ms 2896 KB Output is correct
31 Correct 4 ms 2128 KB Output is correct
32 Correct 30 ms 3632 KB Output is correct
33 Correct 23 ms 3692 KB Output is correct
34 Correct 892 ms 3864 KB Output is correct
35 Correct 728 ms 3840 KB Output is correct
36 Correct 797 ms 3804 KB Output is correct
37 Correct 355 ms 3800 KB Output is correct
38 Correct 370 ms 3520 KB Output is correct
39 Correct 454 ms 3580 KB Output is correct
40 Correct 803 ms 3968 KB Output is correct
41 Correct 391 ms 3528 KB Output is correct
42 Correct 198 ms 3480 KB Output is correct
43 Execution timed out 4097 ms 3956 KB Time limit exceeded
44 Halted 0 ms 0 KB -