Submission #591555

# Submission time Handle Problem Language Result Execution time Memory
591555 2022-07-07T14:57:42 Z MDario Game (APIO22_game) C++17
60 / 100
4000 ms 23880 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int n, k;
int e[300000];
vector<int> ad[300000];
bool r=0;
void dfs(int xf){
    for(auto i : ad[xf]){
        if(i<=e[xf])r=1;
        else if(e[i]<e[xf]){
            e[i]=e[xf];
            dfs(i);
        }
    }
    return;
}
void init(int N, int K) {
    n=N;
    k=K;
    for(int i=0; i<k; i++)e[i]=i;
    for(int i=k; i<n; i++)e[i]=-1;
    return;
}

int add_teleporter(int u, int v) {
    if(r)return 1;
    ad[u].push_back(v);
    if(v<=e[u])r=1;
    else if(e[v]<e[u]){
        dfs(u);
    }
    return r;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 5 ms 7248 KB Output is correct
5 Correct 4 ms 7268 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 5 ms 7248 KB Output is correct
5 Correct 4 ms 7268 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 6 ms 7248 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 5 ms 7388 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 5 ms 7300 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7348 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 5 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 5 ms 7248 KB Output is correct
5 Correct 4 ms 7268 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 6 ms 7248 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 5 ms 7388 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 5 ms 7300 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7348 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 5 ms 7248 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 5 ms 7248 KB Output is correct
22 Correct 5 ms 7376 KB Output is correct
23 Correct 5 ms 7424 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7364 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 6 ms 7376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 5 ms 7248 KB Output is correct
5 Correct 4 ms 7268 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 6 ms 7248 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 5 ms 7388 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 5 ms 7300 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7348 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 5 ms 7248 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 5 ms 7248 KB Output is correct
22 Correct 5 ms 7376 KB Output is correct
23 Correct 5 ms 7424 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7364 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 6 ms 7376 KB Output is correct
30 Correct 21 ms 7976 KB Output is correct
31 Correct 10 ms 7604 KB Output is correct
32 Correct 19 ms 8656 KB Output is correct
33 Correct 22 ms 8404 KB Output is correct
34 Correct 547 ms 9848 KB Output is correct
35 Correct 180 ms 8864 KB Output is correct
36 Correct 33 ms 8380 KB Output is correct
37 Correct 31 ms 8340 KB Output is correct
38 Correct 26 ms 8184 KB Output is correct
39 Correct 23 ms 8108 KB Output is correct
40 Correct 418 ms 9760 KB Output is correct
41 Correct 101 ms 8632 KB Output is correct
42 Correct 69 ms 8452 KB Output is correct
43 Correct 40 ms 9740 KB Output is correct
44 Correct 295 ms 9756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 5 ms 7248 KB Output is correct
5 Correct 4 ms 7268 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 6 ms 7248 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 5 ms 7388 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 5 ms 7300 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7348 KB Output is correct
16 Correct 4 ms 7248 KB Output is correct
17 Correct 4 ms 7248 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 5 ms 7248 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 5 ms 7248 KB Output is correct
22 Correct 5 ms 7376 KB Output is correct
23 Correct 5 ms 7424 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7364 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 6 ms 7376 KB Output is correct
30 Correct 21 ms 7976 KB Output is correct
31 Correct 10 ms 7604 KB Output is correct
32 Correct 19 ms 8656 KB Output is correct
33 Correct 22 ms 8404 KB Output is correct
34 Correct 547 ms 9848 KB Output is correct
35 Correct 180 ms 8864 KB Output is correct
36 Correct 33 ms 8380 KB Output is correct
37 Correct 31 ms 8340 KB Output is correct
38 Correct 26 ms 8184 KB Output is correct
39 Correct 23 ms 8108 KB Output is correct
40 Correct 418 ms 9760 KB Output is correct
41 Correct 101 ms 8632 KB Output is correct
42 Correct 69 ms 8452 KB Output is correct
43 Correct 40 ms 9740 KB Output is correct
44 Correct 295 ms 9756 KB Output is correct
45 Correct 159 ms 14148 KB Output is correct
46 Correct 11 ms 8676 KB Output is correct
47 Correct 8 ms 8656 KB Output is correct
48 Correct 240 ms 23880 KB Output is correct
49 Correct 220 ms 17816 KB Output is correct
50 Execution timed out 4094 ms 20248 KB Time limit exceeded
51 Halted 0 ms 0 KB -