# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982791 |
2024-05-14T18:07:35 Z |
vjudge1 |
Game (APIO22_game) |
C++17 |
|
4000 ms |
29612 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;
if(vis[u]>u) ans=true;
repa(v,adj[u]){
if(vis[v]<r) dfs(v,r);
if(v==r) ans=true;
}
}
int add_teleporter(int u, int v) {
adj[u].pb(v);
dfs(u,vis[u]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
3 ms |
13912 KB |
Output is correct |
4 |
Correct |
5 ms |
13912 KB |
Output is correct |
5 |
Correct |
5 ms |
13836 KB |
Output is correct |
6 |
Correct |
4 ms |
13912 KB |
Output is correct |
7 |
Correct |
6 ms |
14168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
3 ms |
13912 KB |
Output is correct |
4 |
Correct |
5 ms |
13912 KB |
Output is correct |
5 |
Correct |
5 ms |
13836 KB |
Output is correct |
6 |
Correct |
4 ms |
13912 KB |
Output is correct |
7 |
Correct |
6 ms |
14168 KB |
Output is correct |
8 |
Correct |
4 ms |
13912 KB |
Output is correct |
9 |
Correct |
4 ms |
13912 KB |
Output is correct |
10 |
Correct |
3 ms |
13912 KB |
Output is correct |
11 |
Correct |
4 ms |
13752 KB |
Output is correct |
12 |
Correct |
3 ms |
13912 KB |
Output is correct |
13 |
Correct |
3 ms |
13912 KB |
Output is correct |
14 |
Correct |
3 ms |
13912 KB |
Output is correct |
15 |
Correct |
4 ms |
13752 KB |
Output is correct |
16 |
Correct |
4 ms |
14168 KB |
Output is correct |
17 |
Correct |
4 ms |
13912 KB |
Output is correct |
18 |
Correct |
3 ms |
13912 KB |
Output is correct |
19 |
Correct |
3 ms |
13912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
3 ms |
13912 KB |
Output is correct |
4 |
Correct |
5 ms |
13912 KB |
Output is correct |
5 |
Correct |
5 ms |
13836 KB |
Output is correct |
6 |
Correct |
4 ms |
13912 KB |
Output is correct |
7 |
Correct |
6 ms |
14168 KB |
Output is correct |
8 |
Correct |
4 ms |
13912 KB |
Output is correct |
9 |
Correct |
4 ms |
13912 KB |
Output is correct |
10 |
Correct |
3 ms |
13912 KB |
Output is correct |
11 |
Correct |
4 ms |
13752 KB |
Output is correct |
12 |
Correct |
3 ms |
13912 KB |
Output is correct |
13 |
Correct |
3 ms |
13912 KB |
Output is correct |
14 |
Correct |
3 ms |
13912 KB |
Output is correct |
15 |
Correct |
4 ms |
13752 KB |
Output is correct |
16 |
Correct |
4 ms |
14168 KB |
Output is correct |
17 |
Correct |
4 ms |
13912 KB |
Output is correct |
18 |
Correct |
3 ms |
13912 KB |
Output is correct |
19 |
Correct |
3 ms |
13912 KB |
Output is correct |
20 |
Correct |
4 ms |
13912 KB |
Output is correct |
21 |
Correct |
4 ms |
13912 KB |
Output is correct |
22 |
Correct |
5 ms |
14168 KB |
Output is correct |
23 |
Correct |
4 ms |
13912 KB |
Output is correct |
24 |
Correct |
6 ms |
13912 KB |
Output is correct |
25 |
Correct |
5 ms |
14168 KB |
Output is correct |
26 |
Correct |
5 ms |
13992 KB |
Output is correct |
27 |
Correct |
6 ms |
13912 KB |
Output is correct |
28 |
Correct |
5 ms |
13912 KB |
Output is correct |
29 |
Correct |
5 ms |
13912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
3 ms |
13912 KB |
Output is correct |
4 |
Correct |
5 ms |
13912 KB |
Output is correct |
5 |
Correct |
5 ms |
13836 KB |
Output is correct |
6 |
Correct |
4 ms |
13912 KB |
Output is correct |
7 |
Correct |
6 ms |
14168 KB |
Output is correct |
8 |
Correct |
4 ms |
13912 KB |
Output is correct |
9 |
Correct |
4 ms |
13912 KB |
Output is correct |
10 |
Correct |
3 ms |
13912 KB |
Output is correct |
11 |
Correct |
4 ms |
13752 KB |
Output is correct |
12 |
Correct |
3 ms |
13912 KB |
Output is correct |
13 |
Correct |
3 ms |
13912 KB |
Output is correct |
14 |
Correct |
3 ms |
13912 KB |
Output is correct |
15 |
Correct |
4 ms |
13752 KB |
Output is correct |
16 |
Correct |
4 ms |
14168 KB |
Output is correct |
17 |
Correct |
4 ms |
13912 KB |
Output is correct |
18 |
Correct |
3 ms |
13912 KB |
Output is correct |
19 |
Correct |
3 ms |
13912 KB |
Output is correct |
20 |
Correct |
4 ms |
13912 KB |
Output is correct |
21 |
Correct |
4 ms |
13912 KB |
Output is correct |
22 |
Correct |
5 ms |
14168 KB |
Output is correct |
23 |
Correct |
4 ms |
13912 KB |
Output is correct |
24 |
Correct |
6 ms |
13912 KB |
Output is correct |
25 |
Correct |
5 ms |
14168 KB |
Output is correct |
26 |
Correct |
5 ms |
13992 KB |
Output is correct |
27 |
Correct |
6 ms |
13912 KB |
Output is correct |
28 |
Correct |
5 ms |
13912 KB |
Output is correct |
29 |
Correct |
5 ms |
13912 KB |
Output is correct |
30 |
Correct |
16 ms |
14936 KB |
Output is correct |
31 |
Correct |
6 ms |
14168 KB |
Output is correct |
32 |
Correct |
19 ms |
15448 KB |
Output is correct |
33 |
Correct |
17 ms |
15704 KB |
Output is correct |
34 |
Correct |
452 ms |
16728 KB |
Output is correct |
35 |
Correct |
166 ms |
15720 KB |
Output is correct |
36 |
Correct |
28 ms |
15528 KB |
Output is correct |
37 |
Correct |
22 ms |
15184 KB |
Output is correct |
38 |
Correct |
22 ms |
15240 KB |
Output is correct |
39 |
Correct |
23 ms |
15192 KB |
Output is correct |
40 |
Correct |
361 ms |
16364 KB |
Output is correct |
41 |
Correct |
82 ms |
15632 KB |
Output is correct |
42 |
Correct |
56 ms |
15092 KB |
Output is correct |
43 |
Correct |
29 ms |
16828 KB |
Output is correct |
44 |
Correct |
258 ms |
16232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
13912 KB |
Output is correct |
2 |
Correct |
5 ms |
13912 KB |
Output is correct |
3 |
Correct |
3 ms |
13912 KB |
Output is correct |
4 |
Correct |
5 ms |
13912 KB |
Output is correct |
5 |
Correct |
5 ms |
13836 KB |
Output is correct |
6 |
Correct |
4 ms |
13912 KB |
Output is correct |
7 |
Correct |
6 ms |
14168 KB |
Output is correct |
8 |
Correct |
4 ms |
13912 KB |
Output is correct |
9 |
Correct |
4 ms |
13912 KB |
Output is correct |
10 |
Correct |
3 ms |
13912 KB |
Output is correct |
11 |
Correct |
4 ms |
13752 KB |
Output is correct |
12 |
Correct |
3 ms |
13912 KB |
Output is correct |
13 |
Correct |
3 ms |
13912 KB |
Output is correct |
14 |
Correct |
3 ms |
13912 KB |
Output is correct |
15 |
Correct |
4 ms |
13752 KB |
Output is correct |
16 |
Correct |
4 ms |
14168 KB |
Output is correct |
17 |
Correct |
4 ms |
13912 KB |
Output is correct |
18 |
Correct |
3 ms |
13912 KB |
Output is correct |
19 |
Correct |
3 ms |
13912 KB |
Output is correct |
20 |
Correct |
4 ms |
13912 KB |
Output is correct |
21 |
Correct |
4 ms |
13912 KB |
Output is correct |
22 |
Correct |
5 ms |
14168 KB |
Output is correct |
23 |
Correct |
4 ms |
13912 KB |
Output is correct |
24 |
Correct |
6 ms |
13912 KB |
Output is correct |
25 |
Correct |
5 ms |
14168 KB |
Output is correct |
26 |
Correct |
5 ms |
13992 KB |
Output is correct |
27 |
Correct |
6 ms |
13912 KB |
Output is correct |
28 |
Correct |
5 ms |
13912 KB |
Output is correct |
29 |
Correct |
5 ms |
13912 KB |
Output is correct |
30 |
Correct |
16 ms |
14936 KB |
Output is correct |
31 |
Correct |
6 ms |
14168 KB |
Output is correct |
32 |
Correct |
19 ms |
15448 KB |
Output is correct |
33 |
Correct |
17 ms |
15704 KB |
Output is correct |
34 |
Correct |
452 ms |
16728 KB |
Output is correct |
35 |
Correct |
166 ms |
15720 KB |
Output is correct |
36 |
Correct |
28 ms |
15528 KB |
Output is correct |
37 |
Correct |
22 ms |
15184 KB |
Output is correct |
38 |
Correct |
22 ms |
15240 KB |
Output is correct |
39 |
Correct |
23 ms |
15192 KB |
Output is correct |
40 |
Correct |
361 ms |
16364 KB |
Output is correct |
41 |
Correct |
82 ms |
15632 KB |
Output is correct |
42 |
Correct |
56 ms |
15092 KB |
Output is correct |
43 |
Correct |
29 ms |
16828 KB |
Output is correct |
44 |
Correct |
258 ms |
16232 KB |
Output is correct |
45 |
Correct |
129 ms |
20084 KB |
Output is correct |
46 |
Correct |
7 ms |
14168 KB |
Output is correct |
47 |
Correct |
7 ms |
14168 KB |
Output is correct |
48 |
Correct |
188 ms |
29612 KB |
Output is correct |
49 |
Correct |
155 ms |
23688 KB |
Output is correct |
50 |
Execution timed out |
4089 ms |
26368 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |