| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1305810 | jojeonghoon | Game (APIO22_game) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "game.h"
using namespace std
const int LM=300100;
int N,K;
vector<int>G[LM];
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 D[LM];
int dfs(int x, int w){
w+=x<K;
if(D[x]) return 1;
D[x]=w;
for(int i:G[x]){
if(dfs(i,w)) return 1;
}
D[x]=0;
return 0;
}
int add_teleporter(int u, int v){
G[u].push_back(v);
return dfs(u,1);
}
