#include "game.h"
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define fi first
#define se second
#define pii pair<int, int>
#define ll long long
#define pb push_back
using namespace std;
int N, K;
const int lim=5e5+5;
vector<int> adj[lim];
bool ans=false, vis[lim];
void init(int n, int k) {
N=n; K=k;
}
void dfs(int u, int p, int r){
vis[u]=true;
repa(v,adj[u]){
if(!vis[v]) dfs(v,u,r);
if(v<K || ans){
ans=true;
return;
}
}
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
if(ans) return 1;
rep(i,0,K){
fill(vis,vis+N,false);
dfs(i,i,i);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12792 KB |
Output is correct |
2 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12792 KB |
Output is correct |
2 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12792 KB |
Output is correct |
2 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12792 KB |
Output is correct |
2 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12792 KB |
Output is correct |
2 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |