This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n,k;
typedef pair<int,int> ii;
#define ff first
#define ss second
const int maxn = 3e4 + 10;
vector <int> adj[maxn];
bool vis[1010][maxn];
stack<int> st;
bool dau[maxn];
bool ccheck = 0;
void dfs(int id, int x)
{
vis[id][x] = 1;
if (x < id) ccheck = 1;
for (int i:adj[x])
if (!vis[id][i]) dfs(id,i);
}
void init(int N, int K) {
n=N; k=K; ccheck=0;
for (int i=1; i<=n; i++) adj[i].clear();
for (int i=2; i<=k; i++) adj[i-1].push_back(i);
for (int i=1; i<=n; i++)
dfs(i,i);
}
int add_teleporter(int u, int v) {
u++; v++;
adj[u].push_back(v);
for (int i=1; i<=k; i++)
if (vis[i][u]&&!vis[i][v]) dfs(i,v);
return ccheck;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |