Submission #729062

# Submission time Handle Problem Language Result Execution time Memory
729062 2023-04-23T13:01:38 Z veehj Game (APIO22_game) C++17
0 / 100
4000 ms 208 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
vector<bool> vist;
int k, n;
vector<vector<int>> adj;
 
void init(int N, int K) {
  k=K; n=N;
  adj.resize(n);
  vist.assign(n, 0);
  for(int i=0; i<k-1; i++) adj[i].pb(i+1);
}
 
int s(int x){
  if(vist[x]){
    if(x<k){
      return 1;
    }
    return 0;
  }
  vist[x]=1;
  for(auto& u : adj[x]){
    if(s(u)==1){
      vist[x]=0;
      return 1;
    }
  }
  vist[x]=0;
  return 0;
}
 
int add_teleporter(int u, int v) {
  adj[u].pb(v);
  return s(0);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4021 ms 208 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4021 ms 208 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4021 ms 208 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4021 ms 208 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4021 ms 208 KB Time limit exceeded
4 Halted 0 ms 0 KB -