Submission #816344

# Submission time Handle Problem Language Result Execution time Memory
816344 2023-08-09T04:52:39 Z 반딧불(#10124) Game (APIO22_game) C++17
60 / 100
2044 ms 148764 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

int n, k;
vector<int> link[30002];
int tosee[1002][30002];
bool visited[1002][30002];

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

bool bfs(int st, int x){
    queue<int> que;
    que.push(x);
    while(!que.empty()){
        int x = que.front(); que.pop();
        visited[st][x] = 1;
        while(tosee[st][x] < (int)link[x].size()){
            int y = link[x][tosee[st][x]++];
            if(y<=st) return true;
            que.push(y);
        }
    }
    return false;
}

int add_teleporter(int u, int v){
    link[u].push_back(v);
    for(int i=0; i<k; i++){
        if(visited[i][u]) if(bfs(i, u)) return true;
    }
    return false;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1408 KB Output is correct
5 Correct 1 ms 1792 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1408 KB Output is correct
5 Correct 1 ms 1792 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 1032 KB Output is correct
13 Correct 1 ms 1024 KB Output is correct
14 Correct 2 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1024 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1232 KB Output is correct
19 Correct 1 ms 1232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1408 KB Output is correct
5 Correct 1 ms 1792 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 1032 KB Output is correct
13 Correct 1 ms 1024 KB Output is correct
14 Correct 2 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1024 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1232 KB Output is correct
19 Correct 1 ms 1232 KB Output is correct
20 Correct 1 ms 1060 KB Output is correct
21 Correct 1 ms 1536 KB Output is correct
22 Correct 1 ms 1360 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 6 ms 5108 KB Output is correct
25 Correct 8 ms 4176 KB Output is correct
26 Correct 5 ms 2000 KB Output is correct
27 Correct 10 ms 6820 KB Output is correct
28 Correct 4 ms 3876 KB Output is correct
29 Correct 8 ms 6352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1408 KB Output is correct
5 Correct 1 ms 1792 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 1032 KB Output is correct
13 Correct 1 ms 1024 KB Output is correct
14 Correct 2 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1024 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1232 KB Output is correct
19 Correct 1 ms 1232 KB Output is correct
20 Correct 1 ms 1060 KB Output is correct
21 Correct 1 ms 1536 KB Output is correct
22 Correct 1 ms 1360 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 6 ms 5108 KB Output is correct
25 Correct 8 ms 4176 KB Output is correct
26 Correct 5 ms 2000 KB Output is correct
27 Correct 10 ms 6820 KB Output is correct
28 Correct 4 ms 3876 KB Output is correct
29 Correct 8 ms 6352 KB Output is correct
30 Correct 19 ms 4852 KB Output is correct
31 Correct 62 ms 7440 KB Output is correct
32 Correct 22 ms 2464 KB Output is correct
33 Correct 15 ms 2676 KB Output is correct
34 Correct 726 ms 78224 KB Output is correct
35 Correct 1611 ms 148764 KB Output is correct
36 Correct 84 ms 11708 KB Output is correct
37 Correct 1248 ms 97072 KB Output is correct
38 Correct 1540 ms 143860 KB Output is correct
39 Correct 1969 ms 146888 KB Output is correct
40 Correct 886 ms 84808 KB Output is correct
41 Correct 1047 ms 88088 KB Output is correct
42 Correct 854 ms 110660 KB Output is correct
43 Correct 2044 ms 112844 KB Output is correct
44 Correct 705 ms 87376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1744 KB Output is correct
4 Correct 1 ms 1408 KB Output is correct
5 Correct 1 ms 1792 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1872 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 1032 KB Output is correct
13 Correct 1 ms 1024 KB Output is correct
14 Correct 2 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1024 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1232 KB Output is correct
19 Correct 1 ms 1232 KB Output is correct
20 Correct 1 ms 1060 KB Output is correct
21 Correct 1 ms 1536 KB Output is correct
22 Correct 1 ms 1360 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 6 ms 5108 KB Output is correct
25 Correct 8 ms 4176 KB Output is correct
26 Correct 5 ms 2000 KB Output is correct
27 Correct 10 ms 6820 KB Output is correct
28 Correct 4 ms 3876 KB Output is correct
29 Correct 8 ms 6352 KB Output is correct
30 Correct 19 ms 4852 KB Output is correct
31 Correct 62 ms 7440 KB Output is correct
32 Correct 22 ms 2464 KB Output is correct
33 Correct 15 ms 2676 KB Output is correct
34 Correct 726 ms 78224 KB Output is correct
35 Correct 1611 ms 148764 KB Output is correct
36 Correct 84 ms 11708 KB Output is correct
37 Correct 1248 ms 97072 KB Output is correct
38 Correct 1540 ms 143860 KB Output is correct
39 Correct 1969 ms 146888 KB Output is correct
40 Correct 886 ms 84808 KB Output is correct
41 Correct 1047 ms 88088 KB Output is correct
42 Correct 854 ms 110660 KB Output is correct
43 Correct 2044 ms 112844 KB Output is correct
44 Correct 705 ms 87376 KB Output is correct
45 Runtime error 5 ms 2544 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -