Submission #816295

# Submission time Handle Problem Language Result Execution time Memory
816295 2023-08-09T04:43:13 Z 반딧불(#10124) Game (APIO22_game) C++17
30 / 100
4000 ms 148740 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++){
        for(int j=i; j<k; j++) visited[i][j] = 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 1368 KB Output is correct
5 Correct 2 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 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 1368 KB Output is correct
5 Correct 2 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 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 1104 KB Output is correct
12 Correct 1 ms 1088 KB Output is correct
13 Correct 1 ms 1104 KB Output is correct
14 Correct 1 ms 1296 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1088 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1360 KB Output is correct
19 Correct 1 ms 1360 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 1368 KB Output is correct
5 Correct 2 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 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 1104 KB Output is correct
12 Correct 1 ms 1088 KB Output is correct
13 Correct 1 ms 1104 KB Output is correct
14 Correct 1 ms 1296 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1088 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1360 KB Output is correct
19 Correct 1 ms 1360 KB Output is correct
20 Correct 1 ms 1104 KB Output is correct
21 Correct 1 ms 1872 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 2 ms 1104 KB Output is correct
24 Correct 8 ms 5228 KB Output is correct
25 Correct 25 ms 4184 KB Output is correct
26 Correct 15 ms 2300 KB Output is correct
27 Correct 63 ms 7008 KB Output is correct
28 Correct 18 ms 6688 KB Output is correct
29 Correct 35 ms 6716 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 1368 KB Output is correct
5 Correct 2 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 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 1104 KB Output is correct
12 Correct 1 ms 1088 KB Output is correct
13 Correct 1 ms 1104 KB Output is correct
14 Correct 1 ms 1296 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1088 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1360 KB Output is correct
19 Correct 1 ms 1360 KB Output is correct
20 Correct 1 ms 1104 KB Output is correct
21 Correct 1 ms 1872 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 2 ms 1104 KB Output is correct
24 Correct 8 ms 5228 KB Output is correct
25 Correct 25 ms 4184 KB Output is correct
26 Correct 15 ms 2300 KB Output is correct
27 Correct 63 ms 7008 KB Output is correct
28 Correct 18 ms 6688 KB Output is correct
29 Correct 35 ms 6716 KB Output is correct
30 Correct 35 ms 15168 KB Output is correct
31 Correct 167 ms 89952 KB Output is correct
32 Correct 27 ms 5360 KB Output is correct
33 Correct 10 ms 3064 KB Output is correct
34 Correct 777 ms 78348 KB Output is correct
35 Correct 3687 ms 148740 KB Output is correct
36 Correct 183 ms 16412 KB Output is correct
37 Execution timed out 4014 ms 148640 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 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 1368 KB Output is correct
5 Correct 2 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 1 ms 1744 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 1104 KB Output is correct
12 Correct 1 ms 1088 KB Output is correct
13 Correct 1 ms 1104 KB Output is correct
14 Correct 1 ms 1296 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1088 KB Output is correct
17 Correct 1 ms 1360 KB Output is correct
18 Correct 1 ms 1360 KB Output is correct
19 Correct 1 ms 1360 KB Output is correct
20 Correct 1 ms 1104 KB Output is correct
21 Correct 1 ms 1872 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 2 ms 1104 KB Output is correct
24 Correct 8 ms 5228 KB Output is correct
25 Correct 25 ms 4184 KB Output is correct
26 Correct 15 ms 2300 KB Output is correct
27 Correct 63 ms 7008 KB Output is correct
28 Correct 18 ms 6688 KB Output is correct
29 Correct 35 ms 6716 KB Output is correct
30 Correct 35 ms 15168 KB Output is correct
31 Correct 167 ms 89952 KB Output is correct
32 Correct 27 ms 5360 KB Output is correct
33 Correct 10 ms 3064 KB Output is correct
34 Correct 777 ms 78348 KB Output is correct
35 Correct 3687 ms 148740 KB Output is correct
36 Correct 183 ms 16412 KB Output is correct
37 Execution timed out 4014 ms 148640 KB Time limit exceeded
38 Halted 0 ms 0 KB -