답안 #983829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983829 2024-05-16T07:05:38 Z vjudge1 게임 (APIO22_game) C++17
30 / 100
4000 ms 3860 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 3e4 + 100;
vector<int> g[N];
int flag = 0;
int k, visited[N], n;

void dfs(int x) {
    visited[x] = 1;
    for (auto to : g[x]) {
        if (!visited[to])
            dfs(to);
        else if (visited[to] == 1 && to < k)
            flag = 1;
    }
    visited[x] = 2;
}

void init(int n, int k) {
    ::k = k;
    ::n = n;
    for (int i = 0; i < k - 1; i++) {
        g[i].push_back(i + 1);
    }
}

int add_teleporter(int u, int v) {
    g[u].push_back(v);
    for (int i = 0; i < n; i++) {
        visited[i] = 0;
    }
    for (int i = 0; i < k; i++) {
        if (!visited[i])
            dfs(i);
    }
    return flag;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 1 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 2 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 1 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 2 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 2 ms 1112 KB Output is correct
23 Correct 1 ms 1124 KB Output is correct
24 Correct 6 ms 1112 KB Output is correct
25 Correct 23 ms 1624 KB Output is correct
26 Correct 27 ms 1368 KB Output is correct
27 Correct 34 ms 1112 KB Output is correct
28 Correct 12 ms 1204 KB Output is correct
29 Correct 25 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 1 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 2 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 2 ms 1112 KB Output is correct
23 Correct 1 ms 1124 KB Output is correct
24 Correct 6 ms 1112 KB Output is correct
25 Correct 23 ms 1624 KB Output is correct
26 Correct 27 ms 1368 KB Output is correct
27 Correct 34 ms 1112 KB Output is correct
28 Correct 12 ms 1204 KB Output is correct
29 Correct 25 ms 1112 KB Output is correct
30 Correct 125 ms 2232 KB Output is correct
31 Correct 68 ms 1368 KB Output is correct
32 Correct 93 ms 2872 KB Output is correct
33 Correct 59 ms 2768 KB Output is correct
34 Correct 1105 ms 3860 KB Output is correct
35 Execution timed out 4043 ms 2496 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 1 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 1 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1112 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 1 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 2 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 2 ms 1112 KB Output is correct
23 Correct 1 ms 1124 KB Output is correct
24 Correct 6 ms 1112 KB Output is correct
25 Correct 23 ms 1624 KB Output is correct
26 Correct 27 ms 1368 KB Output is correct
27 Correct 34 ms 1112 KB Output is correct
28 Correct 12 ms 1204 KB Output is correct
29 Correct 25 ms 1112 KB Output is correct
30 Correct 125 ms 2232 KB Output is correct
31 Correct 68 ms 1368 KB Output is correct
32 Correct 93 ms 2872 KB Output is correct
33 Correct 59 ms 2768 KB Output is correct
34 Correct 1105 ms 3860 KB Output is correct
35 Execution timed out 4043 ms 2496 KB Time limit exceeded
36 Halted 0 ms 0 KB -