#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;
int vis[lim];
vector<int> sub[lim];
void init(int n, int k) {
N=n; K=k;
fill(vis,vis+n,-1);
rep(i,0,k) vis[i]=i;
}
void dfs(int u, int r){
//cout<<u<<" "<<vis[u]<<" "<<r<<endl;
vis[u]=max(vis[u],r);
if(u<K && vis[u]>u) ans=true;
repa(v,adj[u]) if(vis[v]<r) dfs(v,r);
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
if(vis[u]!=-1) dfs(u,vis[u]);
if(u==v && u<K) ans=true;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
24920 KB |
Output is correct |
2 |
Correct |
10 ms |
24920 KB |
Output is correct |
3 |
Correct |
8 ms |
25080 KB |
Output is correct |
4 |
Correct |
8 ms |
24920 KB |
Output is correct |
5 |
Correct |
8 ms |
24920 KB |
Output is correct |
6 |
Correct |
9 ms |
24920 KB |
Output is correct |
7 |
Correct |
9 ms |
25172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
24920 KB |
Output is correct |
2 |
Correct |
10 ms |
24920 KB |
Output is correct |
3 |
Correct |
8 ms |
25080 KB |
Output is correct |
4 |
Correct |
8 ms |
24920 KB |
Output is correct |
5 |
Correct |
8 ms |
24920 KB |
Output is correct |
6 |
Correct |
9 ms |
24920 KB |
Output is correct |
7 |
Correct |
9 ms |
25172 KB |
Output is correct |
8 |
Correct |
11 ms |
24920 KB |
Output is correct |
9 |
Correct |
11 ms |
24920 KB |
Output is correct |
10 |
Correct |
13 ms |
24920 KB |
Output is correct |
11 |
Correct |
11 ms |
24948 KB |
Output is correct |
12 |
Correct |
9 ms |
24920 KB |
Output is correct |
13 |
Incorrect |
8 ms |
24920 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
24920 KB |
Output is correct |
2 |
Correct |
10 ms |
24920 KB |
Output is correct |
3 |
Correct |
8 ms |
25080 KB |
Output is correct |
4 |
Correct |
8 ms |
24920 KB |
Output is correct |
5 |
Correct |
8 ms |
24920 KB |
Output is correct |
6 |
Correct |
9 ms |
24920 KB |
Output is correct |
7 |
Correct |
9 ms |
25172 KB |
Output is correct |
8 |
Correct |
11 ms |
24920 KB |
Output is correct |
9 |
Correct |
11 ms |
24920 KB |
Output is correct |
10 |
Correct |
13 ms |
24920 KB |
Output is correct |
11 |
Correct |
11 ms |
24948 KB |
Output is correct |
12 |
Correct |
9 ms |
24920 KB |
Output is correct |
13 |
Incorrect |
8 ms |
24920 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
24920 KB |
Output is correct |
2 |
Correct |
10 ms |
24920 KB |
Output is correct |
3 |
Correct |
8 ms |
25080 KB |
Output is correct |
4 |
Correct |
8 ms |
24920 KB |
Output is correct |
5 |
Correct |
8 ms |
24920 KB |
Output is correct |
6 |
Correct |
9 ms |
24920 KB |
Output is correct |
7 |
Correct |
9 ms |
25172 KB |
Output is correct |
8 |
Correct |
11 ms |
24920 KB |
Output is correct |
9 |
Correct |
11 ms |
24920 KB |
Output is correct |
10 |
Correct |
13 ms |
24920 KB |
Output is correct |
11 |
Correct |
11 ms |
24948 KB |
Output is correct |
12 |
Correct |
9 ms |
24920 KB |
Output is correct |
13 |
Incorrect |
8 ms |
24920 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
24920 KB |
Output is correct |
2 |
Correct |
10 ms |
24920 KB |
Output is correct |
3 |
Correct |
8 ms |
25080 KB |
Output is correct |
4 |
Correct |
8 ms |
24920 KB |
Output is correct |
5 |
Correct |
8 ms |
24920 KB |
Output is correct |
6 |
Correct |
9 ms |
24920 KB |
Output is correct |
7 |
Correct |
9 ms |
25172 KB |
Output is correct |
8 |
Correct |
11 ms |
24920 KB |
Output is correct |
9 |
Correct |
11 ms |
24920 KB |
Output is correct |
10 |
Correct |
13 ms |
24920 KB |
Output is correct |
11 |
Correct |
11 ms |
24948 KB |
Output is correct |
12 |
Correct |
9 ms |
24920 KB |
Output is correct |
13 |
Incorrect |
8 ms |
24920 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |