Submission #744776

# Submission time Handle Problem Language Result Execution time Memory
744776 2023-05-19T05:10:17 Z Teemka Game (APIO22_game) C++17
30 / 100
4000 ms 7532 KB
#include "bits/stdc++.h"
#include "game.h"

#define F first 
#define S second 

#define OK cout << "------OK---------" << endl;
#define deb(x) cout << #x << " = " << x << endl;

#define ll long long ;
using namespace std ;
const int N = 2e5 + 7;
const int INF = 1e9 + 7 ;
const int dx[4] = {0 , 1 , 0 , -1} , dy[4] = {1 , 0 , -1 , 0} ;
int n , k , used[N]  , tim = 0 , ok = 0;
vector<int > g[N] ;

void dfs(int v , int p){
    used[v] = tim ;
    if(v <= k -1)
        p = v;
    for(int to : g[v]){
        if(used[to] == tim){
            if(to <= p )
                ok = 1;
            continue  ;
        }
        dfs(to , p) ;
    }
}
void init(int _n, int _k) {
    n = _n , k = _k ;
    for(int i = 0; i< k - 1; i++){
        g[i].push_back(i + 1) ;
    }
}

int add_teleporter(int u, int v) {
    g[u].push_back(v) ;
    tim++ ;
    dfs(0 , 0) ;
    return ok ;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4964 KB Output is correct
2 Correct 3 ms 4944 KB Output is correct
3 Correct 3 ms 4944 KB Output is correct
4 Correct 3 ms 4944 KB Output is correct
5 Correct 3 ms 4944 KB Output is correct
6 Correct 3 ms 4944 KB Output is correct
7 Correct 3 ms 4944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4964 KB Output is correct
2 Correct 3 ms 4944 KB Output is correct
3 Correct 3 ms 4944 KB Output is correct
4 Correct 3 ms 4944 KB Output is correct
5 Correct 3 ms 4944 KB Output is correct
6 Correct 3 ms 4944 KB Output is correct
7 Correct 3 ms 4944 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 5072 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
11 Correct 3 ms 4944 KB Output is correct
12 Correct 3 ms 4996 KB Output is correct
13 Correct 3 ms 4944 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 3 ms 4944 KB Output is correct
16 Correct 3 ms 4944 KB Output is correct
17 Correct 3 ms 4944 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 3 ms 4944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4964 KB Output is correct
2 Correct 3 ms 4944 KB Output is correct
3 Correct 3 ms 4944 KB Output is correct
4 Correct 3 ms 4944 KB Output is correct
5 Correct 3 ms 4944 KB Output is correct
6 Correct 3 ms 4944 KB Output is correct
7 Correct 3 ms 4944 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 5072 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
11 Correct 3 ms 4944 KB Output is correct
12 Correct 3 ms 4996 KB Output is correct
13 Correct 3 ms 4944 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 3 ms 4944 KB Output is correct
16 Correct 3 ms 4944 KB Output is correct
17 Correct 3 ms 4944 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 3 ms 4944 KB Output is correct
20 Correct 4 ms 5008 KB Output is correct
21 Correct 3 ms 4944 KB Output is correct
22 Correct 5 ms 4944 KB Output is correct
23 Correct 3 ms 5004 KB Output is correct
24 Correct 11 ms 5064 KB Output is correct
25 Correct 34 ms 4944 KB Output is correct
26 Correct 46 ms 4944 KB Output is correct
27 Correct 56 ms 5040 KB Output is correct
28 Correct 18 ms 4944 KB Output is correct
29 Correct 41 ms 5056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4964 KB Output is correct
2 Correct 3 ms 4944 KB Output is correct
3 Correct 3 ms 4944 KB Output is correct
4 Correct 3 ms 4944 KB Output is correct
5 Correct 3 ms 4944 KB Output is correct
6 Correct 3 ms 4944 KB Output is correct
7 Correct 3 ms 4944 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 5072 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
11 Correct 3 ms 4944 KB Output is correct
12 Correct 3 ms 4996 KB Output is correct
13 Correct 3 ms 4944 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 3 ms 4944 KB Output is correct
16 Correct 3 ms 4944 KB Output is correct
17 Correct 3 ms 4944 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 3 ms 4944 KB Output is correct
20 Correct 4 ms 5008 KB Output is correct
21 Correct 3 ms 4944 KB Output is correct
22 Correct 5 ms 4944 KB Output is correct
23 Correct 3 ms 5004 KB Output is correct
24 Correct 11 ms 5064 KB Output is correct
25 Correct 34 ms 4944 KB Output is correct
26 Correct 46 ms 4944 KB Output is correct
27 Correct 56 ms 5040 KB Output is correct
28 Correct 18 ms 4944 KB Output is correct
29 Correct 41 ms 5056 KB Output is correct
30 Correct 128 ms 5704 KB Output is correct
31 Correct 77 ms 5320 KB Output is correct
32 Correct 56 ms 6752 KB Output is correct
33 Correct 25 ms 5960 KB Output is correct
34 Correct 1134 ms 7532 KB Output is correct
35 Execution timed out 4101 ms 6164 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4964 KB Output is correct
2 Correct 3 ms 4944 KB Output is correct
3 Correct 3 ms 4944 KB Output is correct
4 Correct 3 ms 4944 KB Output is correct
5 Correct 3 ms 4944 KB Output is correct
6 Correct 3 ms 4944 KB Output is correct
7 Correct 3 ms 4944 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 5072 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
11 Correct 3 ms 4944 KB Output is correct
12 Correct 3 ms 4996 KB Output is correct
13 Correct 3 ms 4944 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 3 ms 4944 KB Output is correct
16 Correct 3 ms 4944 KB Output is correct
17 Correct 3 ms 4944 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 3 ms 4944 KB Output is correct
20 Correct 4 ms 5008 KB Output is correct
21 Correct 3 ms 4944 KB Output is correct
22 Correct 5 ms 4944 KB Output is correct
23 Correct 3 ms 5004 KB Output is correct
24 Correct 11 ms 5064 KB Output is correct
25 Correct 34 ms 4944 KB Output is correct
26 Correct 46 ms 4944 KB Output is correct
27 Correct 56 ms 5040 KB Output is correct
28 Correct 18 ms 4944 KB Output is correct
29 Correct 41 ms 5056 KB Output is correct
30 Correct 128 ms 5704 KB Output is correct
31 Correct 77 ms 5320 KB Output is correct
32 Correct 56 ms 6752 KB Output is correct
33 Correct 25 ms 5960 KB Output is correct
34 Correct 1134 ms 7532 KB Output is correct
35 Execution timed out 4101 ms 6164 KB Time limit exceeded
36 Halted 0 ms 0 KB -