# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982784 |
2024-05-14T17:56:38 Z |
vjudge1 |
Game (APIO22_game) |
C++17 |
|
6 ms |
13928 KB |
#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];
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){
vis[u]=r;
repa(v,adj[u]) if(vis[v]<r) dfs(v,r);
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
dfs(u,vis[u]);
rep(i,0,K) if(vis[i]>i) ans=true;
if(u==v && u<K) ans=true;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
5 ms |
13912 KB |
Output is correct |
4 |
Correct |
6 ms |
13928 KB |
Output is correct |
5 |
Correct |
6 ms |
13912 KB |
Output is correct |
6 |
Correct |
5 ms |
13912 KB |
Output is correct |
7 |
Correct |
5 ms |
13912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
5 ms |
13912 KB |
Output is correct |
4 |
Correct |
6 ms |
13928 KB |
Output is correct |
5 |
Correct |
6 ms |
13912 KB |
Output is correct |
6 |
Correct |
5 ms |
13912 KB |
Output is correct |
7 |
Correct |
5 ms |
13912 KB |
Output is correct |
8 |
Correct |
5 ms |
13912 KB |
Output is correct |
9 |
Correct |
5 ms |
13912 KB |
Output is correct |
10 |
Correct |
4 ms |
13912 KB |
Output is correct |
11 |
Correct |
5 ms |
13912 KB |
Output is correct |
12 |
Correct |
5 ms |
13912 KB |
Output is correct |
13 |
Incorrect |
5 ms |
13912 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
5 ms |
13912 KB |
Output is correct |
4 |
Correct |
6 ms |
13928 KB |
Output is correct |
5 |
Correct |
6 ms |
13912 KB |
Output is correct |
6 |
Correct |
5 ms |
13912 KB |
Output is correct |
7 |
Correct |
5 ms |
13912 KB |
Output is correct |
8 |
Correct |
5 ms |
13912 KB |
Output is correct |
9 |
Correct |
5 ms |
13912 KB |
Output is correct |
10 |
Correct |
4 ms |
13912 KB |
Output is correct |
11 |
Correct |
5 ms |
13912 KB |
Output is correct |
12 |
Correct |
5 ms |
13912 KB |
Output is correct |
13 |
Incorrect |
5 ms |
13912 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
5 ms |
13912 KB |
Output is correct |
4 |
Correct |
6 ms |
13928 KB |
Output is correct |
5 |
Correct |
6 ms |
13912 KB |
Output is correct |
6 |
Correct |
5 ms |
13912 KB |
Output is correct |
7 |
Correct |
5 ms |
13912 KB |
Output is correct |
8 |
Correct |
5 ms |
13912 KB |
Output is correct |
9 |
Correct |
5 ms |
13912 KB |
Output is correct |
10 |
Correct |
4 ms |
13912 KB |
Output is correct |
11 |
Correct |
5 ms |
13912 KB |
Output is correct |
12 |
Correct |
5 ms |
13912 KB |
Output is correct |
13 |
Incorrect |
5 ms |
13912 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
5 ms |
13912 KB |
Output is correct |
4 |
Correct |
6 ms |
13928 KB |
Output is correct |
5 |
Correct |
6 ms |
13912 KB |
Output is correct |
6 |
Correct |
5 ms |
13912 KB |
Output is correct |
7 |
Correct |
5 ms |
13912 KB |
Output is correct |
8 |
Correct |
5 ms |
13912 KB |
Output is correct |
9 |
Correct |
5 ms |
13912 KB |
Output is correct |
10 |
Correct |
4 ms |
13912 KB |
Output is correct |
11 |
Correct |
5 ms |
13912 KB |
Output is correct |
12 |
Correct |
5 ms |
13912 KB |
Output is correct |
13 |
Incorrect |
5 ms |
13912 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |