답안 #838628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
838628 2023-08-27T13:32:05 Z finn__ 게임 (APIO22_game) C++17
60 / 100
523 ms 7128 KB
#include <bits/stdc++.h>
#include "game.h"
using namespace std;

constexpr size_t N = 30000, K = 1000;

size_t n, k;
bitset<N> reachable[K];
vector<size_t> edges[N];

void init(int n_, int k_)
{
    n = n_, k = k_;
    for (size_t i = 0; i < k; ++i)
        for (size_t j = i + 1; j < k; ++j)
            reachable[i][j] = 1;
}

bool add_new_reachable(size_t i, size_t u)
{
    if (u <= i)
        return 1;
    reachable[i][u] = 1;
    for (size_t v : edges[u])
        if (!reachable[i][v] && add_new_reachable(i, v))
            return 1;
    return 0;
}

int add_teleporter(int u, int v)
{
    for (size_t i = 0; i < k; ++i)
        if ((reachable[i][u] || u == i) && add_new_reachable(i, v))
            return 1;
    edges[u].push_back(v);
    return 0;
}

Compilation message

game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:33:35: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         if ((reachable[i][u] || u == i) && add_new_reachable(i, v))
      |                                 ~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1484 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1484 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 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 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1484 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 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 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 4 ms 2768 KB Output is correct
25 Correct 6 ms 1932 KB Output is correct
26 Correct 4 ms 1488 KB Output is correct
27 Correct 9 ms 2896 KB Output is correct
28 Correct 5 ms 2784 KB Output is correct
29 Correct 6 ms 2768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1484 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 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 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 4 ms 2768 KB Output is correct
25 Correct 6 ms 1932 KB Output is correct
26 Correct 4 ms 1488 KB Output is correct
27 Correct 9 ms 2896 KB Output is correct
28 Correct 5 ms 2784 KB Output is correct
29 Correct 6 ms 2768 KB Output is correct
30 Correct 15 ms 1872 KB Output is correct
31 Correct 17 ms 5008 KB Output is correct
32 Correct 27 ms 2532 KB Output is correct
33 Correct 10 ms 1872 KB Output is correct
34 Correct 466 ms 6940 KB Output is correct
35 Correct 264 ms 6192 KB Output is correct
36 Correct 49 ms 2308 KB Output is correct
37 Correct 272 ms 5616 KB Output is correct
38 Correct 228 ms 5604 KB Output is correct
39 Correct 254 ms 5448 KB Output is correct
40 Correct 477 ms 7048 KB Output is correct
41 Correct 234 ms 5964 KB Output is correct
42 Correct 191 ms 5764 KB Output is correct
43 Correct 523 ms 6372 KB Output is correct
44 Correct 417 ms 7128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1484 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 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 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 4 ms 2768 KB Output is correct
25 Correct 6 ms 1932 KB Output is correct
26 Correct 4 ms 1488 KB Output is correct
27 Correct 9 ms 2896 KB Output is correct
28 Correct 5 ms 2784 KB Output is correct
29 Correct 6 ms 2768 KB Output is correct
30 Correct 15 ms 1872 KB Output is correct
31 Correct 17 ms 5008 KB Output is correct
32 Correct 27 ms 2532 KB Output is correct
33 Correct 10 ms 1872 KB Output is correct
34 Correct 466 ms 6940 KB Output is correct
35 Correct 264 ms 6192 KB Output is correct
36 Correct 49 ms 2308 KB Output is correct
37 Correct 272 ms 5616 KB Output is correct
38 Correct 228 ms 5604 KB Output is correct
39 Correct 254 ms 5448 KB Output is correct
40 Correct 477 ms 7048 KB Output is correct
41 Correct 234 ms 5964 KB Output is correct
42 Correct 191 ms 5764 KB Output is correct
43 Correct 523 ms 6372 KB Output is correct
44 Correct 417 ms 7128 KB Output is correct
45 Runtime error 2 ms 2556 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -