Submission #579968

# Submission time Handle Problem Language Result Execution time Memory
579968 2022-06-20T12:01:42 Z josanneo22 Game (APIO22_game) C++17
30 / 100
52 ms 464 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
 
vector<int> g[1024];
 
int n, k;
void init(int n, int k) {
  ::n = n;
  ::k = k;
  for (int i = 0; i < k - 1; i++) {
    g[i].push_back(i + 1);
  }
}
 
int color[1024];
bool dfs(int i) {
  if (color[i] == 2)
    return true;
  if (color[i] == 1)
    return i >= k;
  color[i] = 1;
  for (int j : g[i]) {
    if (!dfs(j))
      return false;
  }
  color[i] = 2;
  return true;
}
 
int add_teleporter(int u, int v) {
  memset(color, 0, sizeof(color));
  g[u].push_back(v);
  bool ok = dfs(0);
  return ok ? 0 : 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 9 ms 352 KB Output is correct
25 Correct 35 ms 372 KB Output is correct
26 Correct 47 ms 364 KB Output is correct
27 Correct 52 ms 336 KB Output is correct
28 Correct 15 ms 380 KB Output is correct
29 Correct 36 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 9 ms 352 KB Output is correct
25 Correct 35 ms 372 KB Output is correct
26 Correct 47 ms 364 KB Output is correct
27 Correct 52 ms 336 KB Output is correct
28 Correct 15 ms 380 KB Output is correct
29 Correct 36 ms 372 KB Output is correct
30 Runtime error 1 ms 464 KB Execution killed with signal 11
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 9 ms 352 KB Output is correct
25 Correct 35 ms 372 KB Output is correct
26 Correct 47 ms 364 KB Output is correct
27 Correct 52 ms 336 KB Output is correct
28 Correct 15 ms 380 KB Output is correct
29 Correct 36 ms 372 KB Output is correct
30 Runtime error 1 ms 464 KB Execution killed with signal 11
31 Halted 0 ms 0 KB -