Submission #718556

# Submission time Handle Problem Language Result Execution time Memory
718556 2023-04-04T10:04:55 Z lam Game (APIO22_game) C++17
60 / 100
1461 ms 32684 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int n,k;
typedef pair<int,int> ii;
#define ff first
#define ss second
const int maxn = 3e4 + 10;
vector <int> adj[maxn];
bool vis[1010][maxn];
stack<int> st;
bool dau[maxn];
bool ccheck = 0;
void dfs(int id, int x)
{
    vis[id][x] = 1;
    if (x <= id) ccheck = 1;
    for (int i:adj[x])
        if (!vis[id][i]) dfs(id,i);
}

void init(int N, int K) {
    n=N; k=K; ccheck=0;
    for (int i=1; i<=n; i++) adj[i].clear();
    for (int i=2; i<=k; i++) adj[i-1].push_back(i);
    for (int i=1; i<k; i++)
        dfs(i,i+1);
}

int add_teleporter(int u, int v) {
    u++; v++;
    adj[u].push_back(v);
    for (int i=1; i<=k; i++)
        if ((u==i||vis[i][u])&&!vis[i][v]) dfs(i,v);
    return ccheck;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1488 KB Output is correct
22 Correct 2 ms 1488 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 5 ms 3312 KB Output is correct
25 Correct 5 ms 2288 KB Output is correct
26 Correct 5 ms 1488 KB Output is correct
27 Correct 9 ms 3464 KB Output is correct
28 Correct 6 ms 3280 KB Output is correct
29 Correct 8 ms 3280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1488 KB Output is correct
22 Correct 2 ms 1488 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 5 ms 3312 KB Output is correct
25 Correct 5 ms 2288 KB Output is correct
26 Correct 5 ms 1488 KB Output is correct
27 Correct 9 ms 3464 KB Output is correct
28 Correct 6 ms 3280 KB Output is correct
29 Correct 8 ms 3280 KB Output is correct
30 Correct 25 ms 4384 KB Output is correct
31 Correct 92 ms 29756 KB Output is correct
32 Correct 39 ms 3104 KB Output is correct
33 Correct 15 ms 2144 KB Output is correct
34 Correct 776 ms 20248 KB Output is correct
35 Correct 813 ms 32028 KB Output is correct
36 Correct 104 ms 4812 KB Output is correct
37 Correct 1263 ms 31516 KB Output is correct
38 Correct 1090 ms 31268 KB Output is correct
39 Correct 1100 ms 31180 KB Output is correct
40 Correct 959 ms 32436 KB Output is correct
41 Correct 793 ms 31612 KB Output is correct
42 Correct 758 ms 31380 KB Output is correct
43 Correct 1461 ms 32684 KB Output is correct
44 Correct 843 ms 26832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1488 KB Output is correct
22 Correct 2 ms 1488 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 5 ms 3312 KB Output is correct
25 Correct 5 ms 2288 KB Output is correct
26 Correct 5 ms 1488 KB Output is correct
27 Correct 9 ms 3464 KB Output is correct
28 Correct 6 ms 3280 KB Output is correct
29 Correct 8 ms 3280 KB Output is correct
30 Correct 25 ms 4384 KB Output is correct
31 Correct 92 ms 29756 KB Output is correct
32 Correct 39 ms 3104 KB Output is correct
33 Correct 15 ms 2144 KB Output is correct
34 Correct 776 ms 20248 KB Output is correct
35 Correct 813 ms 32028 KB Output is correct
36 Correct 104 ms 4812 KB Output is correct
37 Correct 1263 ms 31516 KB Output is correct
38 Correct 1090 ms 31268 KB Output is correct
39 Correct 1100 ms 31180 KB Output is correct
40 Correct 959 ms 32436 KB Output is correct
41 Correct 793 ms 31612 KB Output is correct
42 Correct 758 ms 31380 KB Output is correct
43 Correct 1461 ms 32684 KB Output is correct
44 Correct 843 ms 26832 KB Output is correct
45 Runtime error 2 ms 1752 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -