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;
vector<vector<bool>> vis;
vector<vector<int>> adj;
bool acc = 0;
void dfs(int x , int i)
{
if(vis[i][x])
{
return ;
}
if(x < k && x != i)
acc = 1;
vis[i][x] = 1;
for(auto u : adj[x])
{
dfs(u , i);
}
}
void init(int N, int K) {
n = N , k = K;
adj.assign(n , {});
vis.assign(k , vector<bool>(n));
for(int i = 0 ;i < k ; i++)
{
vis[i][i] = 1;
}
}
int add_teleporter(int u, int v) {
if(u < k && u == v)
return 1;
adj[u].push_back(v);
for(int i = 0 ; i < k ; i++)
{
if(vis[i][u])
{
dfs(v , i);
}
}
return acc;
}
# | 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... |