답안 #642602

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642602 2022-09-20T08:26:23 Z danikoynov 게임 (APIO22_game) C++17
60 / 100
1071 ms 5284 KB
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

const int maxk = 5010, maxn = 30010;
vector < int > g[maxn], ng[maxn];
int lat[maxn], erl[maxn], K;
int tf = 0;

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

}

void update_erl(int v)
{
    if (lat[v] >= erl[v])
        tf = 1;
    for (int u : ng[v])
    {
        if (erl[v] < erl[u])
        {
            erl[u] = erl[v];
            update_erl(u);
        }
    }
}

void update_lat(int u)
{
    if (lat[u] >= erl[u])
        tf = 1;
    int mx = lat[u];
    if (u < K)
        mx = max(mx, u);
    for (int v : g[u])
    {
        if (lat[v] < mx)
        {
            lat[v] = mx;
            update_lat(v);
        }
    }
}
int add_teleporter(int u, int v)
{
    g[u].push_back(v);
    ng[v].push_back(u);
    if (erl[v] < erl[u])
    {
        erl[u] = erl[v];
        update_erl(u);
    }
    int mx = lat[u];
    if (u < K)
        mx = max(u, mx);
    if (mx > lat[v])
    {
        lat[v] = mx;
        update_lat(v);
    }
    return tf;
}

Compilation message

game.cpp: In function 'void init(int, int)':
game.cpp:20:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |     for (int i = 0; i < k; i ++)
      |     ^~~
game.cpp:22:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   22 |         for (int i = k; i < n; i ++)
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 2 ms 1616 KB Output is correct
5 Correct 1 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 2 ms 1616 KB Output is correct
5 Correct 1 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1724 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 2 ms 1616 KB Output is correct
5 Correct 1 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1724 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 2 ms 1740 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 1 ms 1744 KB Output is correct
24 Correct 5 ms 1744 KB Output is correct
25 Correct 5 ms 1744 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 2 ms 1744 KB Output is correct
29 Correct 3 ms 1804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 2 ms 1616 KB Output is correct
5 Correct 1 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1724 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 2 ms 1740 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 1 ms 1744 KB Output is correct
24 Correct 5 ms 1744 KB Output is correct
25 Correct 5 ms 1744 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 2 ms 1744 KB Output is correct
29 Correct 3 ms 1804 KB Output is correct
30 Correct 16 ms 3016 KB Output is correct
31 Correct 7 ms 2384 KB Output is correct
32 Correct 23 ms 4420 KB Output is correct
33 Correct 17 ms 3752 KB Output is correct
34 Correct 1071 ms 5168 KB Output is correct
35 Correct 382 ms 4336 KB Output is correct
36 Correct 47 ms 3856 KB Output is correct
37 Correct 43 ms 3820 KB Output is correct
38 Correct 25 ms 3556 KB Output is correct
39 Correct 26 ms 3532 KB Output is correct
40 Correct 797 ms 5260 KB Output is correct
41 Correct 150 ms 3880 KB Output is correct
42 Correct 118 ms 3824 KB Output is correct
43 Correct 35 ms 5284 KB Output is correct
44 Correct 697 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1616 KB Output is correct
2 Correct 1 ms 1616 KB Output is correct
3 Correct 1 ms 1616 KB Output is correct
4 Correct 2 ms 1616 KB Output is correct
5 Correct 1 ms 1616 KB Output is correct
6 Correct 1 ms 1616 KB Output is correct
7 Correct 1 ms 1616 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 1 ms 1616 KB Output is correct
10 Correct 1 ms 1616 KB Output is correct
11 Correct 1 ms 1616 KB Output is correct
12 Correct 1 ms 1616 KB Output is correct
13 Correct 1 ms 1616 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1724 KB Output is correct
16 Correct 1 ms 1616 KB Output is correct
17 Correct 1 ms 1616 KB Output is correct
18 Correct 1 ms 1616 KB Output is correct
19 Correct 1 ms 1616 KB Output is correct
20 Correct 2 ms 1740 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 1 ms 1744 KB Output is correct
24 Correct 5 ms 1744 KB Output is correct
25 Correct 5 ms 1744 KB Output is correct
26 Correct 3 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 2 ms 1744 KB Output is correct
29 Correct 3 ms 1804 KB Output is correct
30 Correct 16 ms 3016 KB Output is correct
31 Correct 7 ms 2384 KB Output is correct
32 Correct 23 ms 4420 KB Output is correct
33 Correct 17 ms 3752 KB Output is correct
34 Correct 1071 ms 5168 KB Output is correct
35 Correct 382 ms 4336 KB Output is correct
36 Correct 47 ms 3856 KB Output is correct
37 Correct 43 ms 3820 KB Output is correct
38 Correct 25 ms 3556 KB Output is correct
39 Correct 26 ms 3532 KB Output is correct
40 Correct 797 ms 5260 KB Output is correct
41 Correct 150 ms 3880 KB Output is correct
42 Correct 118 ms 3824 KB Output is correct
43 Correct 35 ms 5284 KB Output is correct
44 Correct 697 ms 5204 KB Output is correct
45 Runtime error 4 ms 3708 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -