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;
#define INF 2000000000
#define INFLL 3000000000000000000LL
#define ll long long
int spec;
int num;
vector<vector<int>>adj;
vector<bool>vis;
void dfs(int i){
if(!vis[i]){
vis[i]=1;
num--;
}
for(int u:adj[i]){
if(!vis[u]){
dfs(u);
}
}
}
void init(int n, int k) {
adj.resize(n);
vis.assign(n, 0);
spec=k;
num=n-k;
for(int i=0;i<k;i++)vis[i]=1;
}
int add_teleporter(int u, int v) {
adj[u].push_back(v);
if(vis[u])dfs(u);
return num==0;
}
# | 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... |