#include "game.h"
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repr(a,b,c) for(int a=b-1; a>c-1; 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 r){
vis[u]=true;
repa(v,adj[u]){
if(!vis[v]) dfs(v,r);
if(v<=r || ans){
ans=true;
return;
}
}
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
if(ans) return 1;
repr(i,K,0) dfs(i,i);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12376 KB |
Output is correct |
2 |
Correct |
3 ms |
12376 KB |
Output is correct |
3 |
Correct |
3 ms |
12376 KB |
Output is correct |
4 |
Correct |
3 ms |
12376 KB |
Output is correct |
5 |
Correct |
4 ms |
12376 KB |
Output is correct |
6 |
Correct |
3 ms |
12376 KB |
Output is correct |
7 |
Correct |
4 ms |
12376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12376 KB |
Output is correct |
2 |
Correct |
3 ms |
12376 KB |
Output is correct |
3 |
Correct |
3 ms |
12376 KB |
Output is correct |
4 |
Correct |
3 ms |
12376 KB |
Output is correct |
5 |
Correct |
4 ms |
12376 KB |
Output is correct |
6 |
Correct |
3 ms |
12376 KB |
Output is correct |
7 |
Correct |
4 ms |
12376 KB |
Output is correct |
8 |
Correct |
3 ms |
12472 KB |
Output is correct |
9 |
Correct |
3 ms |
12376 KB |
Output is correct |
10 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12376 KB |
Output is correct |
2 |
Correct |
3 ms |
12376 KB |
Output is correct |
3 |
Correct |
3 ms |
12376 KB |
Output is correct |
4 |
Correct |
3 ms |
12376 KB |
Output is correct |
5 |
Correct |
4 ms |
12376 KB |
Output is correct |
6 |
Correct |
3 ms |
12376 KB |
Output is correct |
7 |
Correct |
4 ms |
12376 KB |
Output is correct |
8 |
Correct |
3 ms |
12472 KB |
Output is correct |
9 |
Correct |
3 ms |
12376 KB |
Output is correct |
10 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12376 KB |
Output is correct |
2 |
Correct |
3 ms |
12376 KB |
Output is correct |
3 |
Correct |
3 ms |
12376 KB |
Output is correct |
4 |
Correct |
3 ms |
12376 KB |
Output is correct |
5 |
Correct |
4 ms |
12376 KB |
Output is correct |
6 |
Correct |
3 ms |
12376 KB |
Output is correct |
7 |
Correct |
4 ms |
12376 KB |
Output is correct |
8 |
Correct |
3 ms |
12472 KB |
Output is correct |
9 |
Correct |
3 ms |
12376 KB |
Output is correct |
10 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
12376 KB |
Output is correct |
2 |
Correct |
3 ms |
12376 KB |
Output is correct |
3 |
Correct |
3 ms |
12376 KB |
Output is correct |
4 |
Correct |
3 ms |
12376 KB |
Output is correct |
5 |
Correct |
4 ms |
12376 KB |
Output is correct |
6 |
Correct |
3 ms |
12376 KB |
Output is correct |
7 |
Correct |
4 ms |
12376 KB |
Output is correct |
8 |
Correct |
3 ms |
12472 KB |
Output is correct |
9 |
Correct |
3 ms |
12376 KB |
Output is correct |
10 |
Incorrect |
3 ms |
12376 KB |
Wrong Answer[1] |
11 |
Halted |
0 ms |
0 KB |
- |