Submission #642544

# Submission time Handle Problem Language Result Execution time Memory
642544 2022-09-19T21:06:10 Z danikoynov Game (APIO22_game) C++17
60 / 100
2725 ms 119544 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];
int used[maxk][maxn], tf, K;

void add_edge(int i, int u, int v)
{
    if (used[i][u] == 0)
        return;

    if (used[i][v])
    {
        if (v <= i)
            tf = 1;
        return;
    }

    queue < int > q;
    q.push(v);
    used[i][v] = 1;
    while(!q.empty())
    {
        int cur = q.front();
        ///cout << i << " :: " << cur << endl;
        q.pop();
        if (cur <= i)
            tf = 1;
            for (int nb : g[cur])
            {
                if (used[i][nb] == 0)
                {
                    used[i][nb] = 1;
                    q.push(nb);
                }
                else
                if (nb <= i)
                tf = 1;
            }

    }
}
void init(int n, int k)
{
    K = k;

    for (int i = 0; i < k; i ++)
        for (int j = i; j < k; j ++)
        used[i][j] = 1;
}

int add_teleporter(int u, int v)
{
    g[u].push_back(v);
    for (int i = 0; i < K; i ++)
    {
        add_edge(i, u, v);
    }
    return tf;
}

Compilation message

game.cpp: In function 'void add_edge(int, int, int)':
game.cpp:31:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   31 |         if (cur <= i)
      |         ^~
game.cpp:33:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   33 |             for (int nb : g[cur])
      |             ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 1 ms 1456 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 1 ms 1456 KB Output is correct
7 Correct 1 ms 1360 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 1232 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 1 ms 1456 KB Output is correct
7 Correct 1 ms 1360 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 1232 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1144 KB Output is correct
20 Correct 1 ms 1104 KB Output is correct
21 Correct 1 ms 1744 KB Output is correct
22 Correct 3 ms 1616 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 7 ms 4040 KB Output is correct
25 Correct 15 ms 2972 KB Output is correct
26 Correct 10 ms 1744 KB Output is correct
27 Correct 25 ms 4688 KB Output is correct
28 Correct 9 ms 4432 KB Output is correct
29 Correct 19 ms 4408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 1 ms 1456 KB Output is correct
7 Correct 1 ms 1360 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 1232 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1144 KB Output is correct
20 Correct 1 ms 1104 KB Output is correct
21 Correct 1 ms 1744 KB Output is correct
22 Correct 3 ms 1616 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 7 ms 4040 KB Output is correct
25 Correct 15 ms 2972 KB Output is correct
26 Correct 10 ms 1744 KB Output is correct
27 Correct 25 ms 4688 KB Output is correct
28 Correct 9 ms 4432 KB Output is correct
29 Correct 19 ms 4408 KB Output is correct
30 Correct 57 ms 12468 KB Output is correct
31 Correct 228 ms 106488 KB Output is correct
32 Correct 74 ms 4744 KB Output is correct
33 Correct 16 ms 2868 KB Output is correct
34 Correct 786 ms 63968 KB Output is correct
35 Correct 1963 ms 119544 KB Output is correct
36 Correct 208 ms 13560 KB Output is correct
37 Correct 2274 ms 119380 KB Output is correct
38 Correct 2603 ms 119092 KB Output is correct
39 Correct 2725 ms 119200 KB Output is correct
40 Correct 1669 ms 119020 KB Output is correct
41 Correct 1896 ms 119300 KB Output is correct
42 Correct 2050 ms 119400 KB Output is correct
43 Correct 1744 ms 119484 KB Output is correct
44 Correct 868 ms 93620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 1 ms 1456 KB Output is correct
7 Correct 1 ms 1360 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 1232 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1144 KB Output is correct
20 Correct 1 ms 1104 KB Output is correct
21 Correct 1 ms 1744 KB Output is correct
22 Correct 3 ms 1616 KB Output is correct
23 Correct 1 ms 1104 KB Output is correct
24 Correct 7 ms 4040 KB Output is correct
25 Correct 15 ms 2972 KB Output is correct
26 Correct 10 ms 1744 KB Output is correct
27 Correct 25 ms 4688 KB Output is correct
28 Correct 9 ms 4432 KB Output is correct
29 Correct 19 ms 4408 KB Output is correct
30 Correct 57 ms 12468 KB Output is correct
31 Correct 228 ms 106488 KB Output is correct
32 Correct 74 ms 4744 KB Output is correct
33 Correct 16 ms 2868 KB Output is correct
34 Correct 786 ms 63968 KB Output is correct
35 Correct 1963 ms 119544 KB Output is correct
36 Correct 208 ms 13560 KB Output is correct
37 Correct 2274 ms 119380 KB Output is correct
38 Correct 2603 ms 119092 KB Output is correct
39 Correct 2725 ms 119200 KB Output is correct
40 Correct 1669 ms 119020 KB Output is correct
41 Correct 1896 ms 119300 KB Output is correct
42 Correct 2050 ms 119400 KB Output is correct
43 Correct 1744 ms 119484 KB Output is correct
44 Correct 868 ms 93620 KB Output is correct
45 Runtime error 9 ms 1880 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -