답안 #652960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
652960 2022-10-25T09:50:44 Z aryan12 게임 (APIO22_game) C++17
60 / 100
4000 ms 21908 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 3e5 + 5;
vector<int> g[N];
int max_n, max_k;
int aa[N];
bool isCycle = false;

void init(int n, int k)
{
    max_n = n, max_k = k;
    for(int i = 0; i < n; i++)
    {
        aa[i] = (i < k) ? i : -1;
    }
}

void dfs(int node, int val)
{
    if(aa[node] >= val)
    {
        return;
    }
    aa[node] = val;
    for(int to: g[node])
    {
        if(to < max_k)
        {
            if(val >= to)
            {
                isCycle = true;
                break;
            }
            continue;
        }
        dfs(to, val);
    }
}

int add_teleporter(int u, int v)
{
    g[u].push_back(v);
    if((v < max_k && aa[u] >= v) || (u < max_k && v <= u))
    {
        return true;
    }
    if(aa[v] < aa[u])
    {
        dfs(v, aa[u]);
    }
    return isCycle;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7308 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7308 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 4 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 5 ms 7320 KB Output is correct
23 Correct 6 ms 7284 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7376 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 6 ms 7376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7308 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 4 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 5 ms 7320 KB Output is correct
23 Correct 6 ms 7284 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7376 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 6 ms 7376 KB Output is correct
30 Correct 17 ms 8008 KB Output is correct
31 Correct 8 ms 7632 KB Output is correct
32 Correct 16 ms 8568 KB Output is correct
33 Correct 18 ms 8368 KB Output is correct
34 Correct 465 ms 9396 KB Output is correct
35 Correct 171 ms 8716 KB Output is correct
36 Correct 29 ms 8324 KB Output is correct
37 Correct 24 ms 8264 KB Output is correct
38 Correct 26 ms 8008 KB Output is correct
39 Correct 26 ms 8136 KB Output is correct
40 Correct 384 ms 9372 KB Output is correct
41 Correct 88 ms 8496 KB Output is correct
42 Correct 61 ms 8340 KB Output is correct
43 Correct 31 ms 9288 KB Output is correct
44 Correct 293 ms 9304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7308 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 4 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 5 ms 7320 KB Output is correct
23 Correct 6 ms 7284 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7376 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 6 ms 7376 KB Output is correct
30 Correct 17 ms 8008 KB Output is correct
31 Correct 8 ms 7632 KB Output is correct
32 Correct 16 ms 8568 KB Output is correct
33 Correct 18 ms 8368 KB Output is correct
34 Correct 465 ms 9396 KB Output is correct
35 Correct 171 ms 8716 KB Output is correct
36 Correct 29 ms 8324 KB Output is correct
37 Correct 24 ms 8264 KB Output is correct
38 Correct 26 ms 8008 KB Output is correct
39 Correct 26 ms 8136 KB Output is correct
40 Correct 384 ms 9372 KB Output is correct
41 Correct 88 ms 8496 KB Output is correct
42 Correct 61 ms 8340 KB Output is correct
43 Correct 31 ms 9288 KB Output is correct
44 Correct 293 ms 9304 KB Output is correct
45 Correct 168 ms 14116 KB Output is correct
46 Correct 9 ms 8656 KB Output is correct
47 Correct 11 ms 8624 KB Output is correct
48 Correct 236 ms 21908 KB Output is correct
49 Correct 171 ms 17864 KB Output is correct
50 Execution timed out 4011 ms 17892 KB Time limit exceeded
51 Halted 0 ms 0 KB -