답안 #816321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
816321 2023-08-09T04:48:56 Z 반딧불(#10124) 게임 (APIO22_game) C++17
30 / 100
4000 ms 148672 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<pair<int, int> > que;
    que.push(make_pair(x, tosee[st][x]));
    while(!que.empty()){
        int x = que.front().first, s = que.front().second; que.pop();
        visited[st][x] = 1;
        for(int i=s; i<(int)link[x].size(); i++){
            int y = link[x][i];
            visited[st][y] = 1;
            if(y==st) return true;
            if(tosee[st][y] == (int)link[y].size()) continue;
            que.push(make_pair(y, tosee[st][y]));
            tosee[st][y] = (int)link[y].size();
        }
    }
    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] && tosee[i][u] != (int)link[u].size()) if(bfs(i, u)) return true;
    }
    return false;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1760 KB Output is correct
4 Correct 1 ms 1232 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 2 ms 1744 KB Output is correct
7 Correct 2 ms 1744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1760 KB Output is correct
4 Correct 1 ms 1232 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 2 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 976 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1760 KB Output is correct
4 Correct 1 ms 1232 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 2 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 976 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 1616 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 21 ms 4912 KB Output is correct
25 Correct 24 ms 3996 KB Output is correct
26 Correct 16 ms 2308 KB Output is correct
27 Correct 88 ms 6736 KB Output is correct
28 Correct 38 ms 6460 KB Output is correct
29 Correct 72 ms 6700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1760 KB Output is correct
4 Correct 1 ms 1232 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 2 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 976 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 1616 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 21 ms 4912 KB Output is correct
25 Correct 24 ms 3996 KB Output is correct
26 Correct 16 ms 2308 KB Output is correct
27 Correct 88 ms 6736 KB Output is correct
28 Correct 38 ms 6460 KB Output is correct
29 Correct 72 ms 6700 KB Output is correct
30 Correct 32 ms 15080 KB Output is correct
31 Correct 142 ms 71188 KB Output is correct
32 Correct 48 ms 5376 KB Output is correct
33 Correct 13 ms 3016 KB Output is correct
34 Correct 971 ms 78368 KB Output is correct
35 Execution timed out 4081 ms 148672 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1760 KB Output is correct
4 Correct 1 ms 1232 KB Output is correct
5 Correct 1 ms 1744 KB Output is correct
6 Correct 2 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 976 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 1616 KB Output is correct
22 Correct 1 ms 1872 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 21 ms 4912 KB Output is correct
25 Correct 24 ms 3996 KB Output is correct
26 Correct 16 ms 2308 KB Output is correct
27 Correct 88 ms 6736 KB Output is correct
28 Correct 38 ms 6460 KB Output is correct
29 Correct 72 ms 6700 KB Output is correct
30 Correct 32 ms 15080 KB Output is correct
31 Correct 142 ms 71188 KB Output is correct
32 Correct 48 ms 5376 KB Output is correct
33 Correct 13 ms 3016 KB Output is correct
34 Correct 971 ms 78368 KB Output is correct
35 Execution timed out 4081 ms 148672 KB Time limit exceeded
36 Halted 0 ms 0 KB -