Submission #960326

# Submission time Handle Problem Language Result Execution time Memory
960326 2024-04-10T09:20:02 Z Alfraganus Game (APIO22_game) C++17
2 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "game.h"
// #include "grader.cpp"
using namespace std;

const int N = 3001;
int mx[N], K;
vector<int> graph[N];

void init(int n, int k)
{
  for (int i = k; i < n; i++)
    mx[i] = -1;
  for (int i = 0; i < k; i++)
    mx[i] = i;
  K = k;
}

int add_teleporter(int u, int v)
{
  if (u == v)
    return u < K;
  graph[u].push_back(v);
  queue<int> q;
  if (mx[v] <= mx[u])
    q.push(v), mx[v] = mx[u];
  while (!q.empty())
  {
    int x = q.front();
    q.pop();
    if (x < K)
    {
      if (mx[x] >= x)
        return 1;
      else
        return 0;
    }
    for (int y : graph[x])
      if (mx[y] < mx[x])
        mx[y] = mx[x], q.push(y);
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Incorrect 0 ms 344 KB Wrong Answer[1]
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Incorrect 0 ms 344 KB Wrong Answer[1]
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Incorrect 0 ms 344 KB Wrong Answer[1]
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 596 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Incorrect 0 ms 344 KB Wrong Answer[1]
14 Halted 0 ms 0 KB -