Submission #816247

# Submission time Handle Problem Language Result Execution time Memory
816247 2023-08-09T04:35:09 Z 반딧불(#10124) Game (APIO22_game) C++17
30 / 100
4000 ms 148732 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++){
        if(i+1<k) link[i].push_back(i+1);
        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 1004 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1828 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 2 ms 1744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1004 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1828 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 2 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 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1104 KB Output is correct
17 Correct 1 ms 1420 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 1004 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1828 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 2 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 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1104 KB Output is correct
17 Correct 1 ms 1420 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 1948 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 10 ms 5200 KB Output is correct
25 Correct 18 ms 4168 KB Output is correct
26 Correct 12 ms 2308 KB Output is correct
27 Correct 67 ms 7008 KB Output is correct
28 Correct 18 ms 6692 KB Output is correct
29 Correct 32 ms 6728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1004 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1828 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 2 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 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1104 KB Output is correct
17 Correct 1 ms 1420 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 1948 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 10 ms 5200 KB Output is correct
25 Correct 18 ms 4168 KB Output is correct
26 Correct 12 ms 2308 KB Output is correct
27 Correct 67 ms 7008 KB Output is correct
28 Correct 18 ms 6692 KB Output is correct
29 Correct 32 ms 6728 KB Output is correct
30 Correct 33 ms 15104 KB Output is correct
31 Correct 153 ms 90016 KB Output is correct
32 Correct 33 ms 5592 KB Output is correct
33 Correct 9 ms 3052 KB Output is correct
34 Correct 781 ms 78440 KB Output is correct
35 Correct 3825 ms 148732 KB Output is correct
36 Correct 233 ms 16420 KB Output is correct
37 Execution timed out 4051 ms 148540 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1004 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1828 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 2 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 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1232 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1104 KB Output is correct
17 Correct 1 ms 1420 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 1948 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 10 ms 5200 KB Output is correct
25 Correct 18 ms 4168 KB Output is correct
26 Correct 12 ms 2308 KB Output is correct
27 Correct 67 ms 7008 KB Output is correct
28 Correct 18 ms 6692 KB Output is correct
29 Correct 32 ms 6728 KB Output is correct
30 Correct 33 ms 15104 KB Output is correct
31 Correct 153 ms 90016 KB Output is correct
32 Correct 33 ms 5592 KB Output is correct
33 Correct 9 ms 3052 KB Output is correct
34 Correct 781 ms 78440 KB Output is correct
35 Correct 3825 ms 148732 KB Output is correct
36 Correct 233 ms 16420 KB Output is correct
37 Execution timed out 4051 ms 148540 KB Time limit exceeded
38 Halted 0 ms 0 KB -