답안 #642604

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642604 2022-09-20T08:27:05 Z danikoynov 게임 (APIO22_game) C++17
60 / 100
1121 ms 5252 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 1 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 1 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 1728 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 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 1644 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 1 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 1728 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 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 1644 KB Output is correct
20 Correct 2 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 6 ms 1744 KB Output is correct
25 Correct 5 ms 1828 KB Output is correct
26 Correct 4 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 4 ms 1784 KB Output is correct
29 Correct 3 ms 1744 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 1 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 1728 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 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 1644 KB Output is correct
20 Correct 2 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 6 ms 1744 KB Output is correct
25 Correct 5 ms 1828 KB Output is correct
26 Correct 4 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 4 ms 1784 KB Output is correct
29 Correct 3 ms 1744 KB Output is correct
30 Correct 17 ms 3036 KB Output is correct
31 Correct 4 ms 2384 KB Output is correct
32 Correct 21 ms 4460 KB Output is correct
33 Correct 16 ms 3784 KB Output is correct
34 Correct 1121 ms 5164 KB Output is correct
35 Correct 348 ms 4332 KB Output is correct
36 Correct 33 ms 3804 KB Output is correct
37 Correct 32 ms 3912 KB Output is correct
38 Correct 29 ms 3528 KB Output is correct
39 Correct 28 ms 3556 KB Output is correct
40 Correct 873 ms 5232 KB Output is correct
41 Correct 156 ms 3872 KB Output is correct
42 Correct 108 ms 3876 KB Output is correct
43 Correct 37 ms 5252 KB Output is correct
44 Correct 790 ms 5200 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 1 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 1728 KB Output is correct
14 Correct 1 ms 1616 KB Output is correct
15 Correct 1 ms 1616 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 1644 KB Output is correct
20 Correct 2 ms 1744 KB Output is correct
21 Correct 1 ms 1616 KB Output is correct
22 Correct 1 ms 1744 KB Output is correct
23 Correct 2 ms 1744 KB Output is correct
24 Correct 6 ms 1744 KB Output is correct
25 Correct 5 ms 1828 KB Output is correct
26 Correct 4 ms 1744 KB Output is correct
27 Correct 3 ms 1744 KB Output is correct
28 Correct 4 ms 1784 KB Output is correct
29 Correct 3 ms 1744 KB Output is correct
30 Correct 17 ms 3036 KB Output is correct
31 Correct 4 ms 2384 KB Output is correct
32 Correct 21 ms 4460 KB Output is correct
33 Correct 16 ms 3784 KB Output is correct
34 Correct 1121 ms 5164 KB Output is correct
35 Correct 348 ms 4332 KB Output is correct
36 Correct 33 ms 3804 KB Output is correct
37 Correct 32 ms 3912 KB Output is correct
38 Correct 29 ms 3528 KB Output is correct
39 Correct 28 ms 3556 KB Output is correct
40 Correct 873 ms 5232 KB Output is correct
41 Correct 156 ms 3872 KB Output is correct
42 Correct 108 ms 3876 KB Output is correct
43 Correct 37 ms 5252 KB Output is correct
44 Correct 790 ms 5200 KB Output is correct
45 Runtime error 3 ms 3736 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -