Submission #816523

# Submission time Handle Problem Language Result Execution time Memory
816523 2023-08-09T05:27:50 Z 이성호(#10126) Game (APIO22_game) C++17
60 / 100
1343 ms 32728 KB
#include "game.h"
#include <vector>
using namespace std;

bool dp[1005][30005];
vector<int> adj[30005];
int N, K;
bool ans = false;

void dfs(int id, int v)
{
  dp[id][v] = true;
  if (v <= id) {
    ans = true;
    return;
  }
  for (int i:adj[v]) {
    if (!dp[id][i]) dfs(id, i);
    if (ans) return;
  }
}

void init(int n, int k) {
  N = n;
  K = k;
  for (int i = 0; i < k; i++) {
    for (int j = i + 1; j < k; j++) {
      dp[i][j] = true;
    }
  }
}

int add_teleporter(int u, int v) {
  if (u == v) {
    return u < K ? 1 : 0;
  }
  adj[u].push_back(v);
  for (int i = 0; i < K; i++) {
    if ((dp[i][u] || i == u) && !dp[i][v]) {
      dfs(i, v);
    }
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 0 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 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 0 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 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 0 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 1196 KB Output is correct
18 Correct 1 ms 1152 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 0 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 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 0 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 1196 KB Output is correct
18 Correct 1 ms 1152 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 1 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 3 ms 3280 KB Output is correct
25 Correct 10 ms 2404 KB Output is correct
26 Correct 4 ms 1492 KB Output is correct
27 Correct 6 ms 3408 KB Output is correct
28 Correct 4 ms 3280 KB Output is correct
29 Correct 7 ms 3452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 0 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 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 0 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 1196 KB Output is correct
18 Correct 1 ms 1152 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 1 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 3 ms 3280 KB Output is correct
25 Correct 10 ms 2404 KB Output is correct
26 Correct 4 ms 1492 KB Output is correct
27 Correct 6 ms 3408 KB Output is correct
28 Correct 4 ms 3280 KB Output is correct
29 Correct 7 ms 3452 KB Output is correct
30 Correct 19 ms 4328 KB Output is correct
31 Correct 89 ms 29688 KB Output is correct
32 Correct 28 ms 3020 KB Output is correct
33 Correct 10 ms 2128 KB Output is correct
34 Correct 655 ms 20164 KB Output is correct
35 Correct 799 ms 31996 KB Output is correct
36 Correct 54 ms 4800 KB Output is correct
37 Correct 1209 ms 31220 KB Output is correct
38 Correct 973 ms 31036 KB Output is correct
39 Correct 1146 ms 31008 KB Output is correct
40 Correct 914 ms 32456 KB Output is correct
41 Correct 764 ms 31512 KB Output is correct
42 Correct 703 ms 31456 KB Output is correct
43 Correct 1343 ms 32728 KB Output is correct
44 Correct 767 ms 26904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 0 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 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 0 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 1196 KB Output is correct
18 Correct 1 ms 1152 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 1 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 3 ms 3280 KB Output is correct
25 Correct 10 ms 2404 KB Output is correct
26 Correct 4 ms 1492 KB Output is correct
27 Correct 6 ms 3408 KB Output is correct
28 Correct 4 ms 3280 KB Output is correct
29 Correct 7 ms 3452 KB Output is correct
30 Correct 19 ms 4328 KB Output is correct
31 Correct 89 ms 29688 KB Output is correct
32 Correct 28 ms 3020 KB Output is correct
33 Correct 10 ms 2128 KB Output is correct
34 Correct 655 ms 20164 KB Output is correct
35 Correct 799 ms 31996 KB Output is correct
36 Correct 54 ms 4800 KB Output is correct
37 Correct 1209 ms 31220 KB Output is correct
38 Correct 973 ms 31036 KB Output is correct
39 Correct 1146 ms 31008 KB Output is correct
40 Correct 914 ms 32456 KB Output is correct
41 Correct 764 ms 31512 KB Output is correct
42 Correct 703 ms 31456 KB Output is correct
43 Correct 1343 ms 32728 KB Output is correct
44 Correct 767 ms 26904 KB Output is correct
45 Runtime error 12 ms 10960 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -