Submission #744873

# Submission time Handle Problem Language Result Execution time Memory
744873 2023-05-19T07:19:23 Z josanneo22 Game (APIO22_game) C++17
60 / 100
1358 ms 32748 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 1060 KB Output is correct
24 Correct 5 ms 3280 KB Output is correct
25 Correct 6 ms 2280 KB Output is correct
26 Correct 4 ms 1488 KB Output is correct
27 Correct 8 ms 3408 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 7 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 1060 KB Output is correct
24 Correct 5 ms 3280 KB Output is correct
25 Correct 6 ms 2280 KB Output is correct
26 Correct 4 ms 1488 KB Output is correct
27 Correct 8 ms 3408 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 7 ms 3280 KB Output is correct
30 Correct 21 ms 4352 KB Output is correct
31 Correct 81 ms 29760 KB Output is correct
32 Correct 43 ms 3100 KB Output is correct
33 Correct 13 ms 2152 KB Output is correct
34 Correct 686 ms 20172 KB Output is correct
35 Correct 839 ms 31844 KB Output is correct
36 Correct 93 ms 4804 KB Output is correct
37 Correct 1124 ms 31360 KB Output is correct
38 Correct 1030 ms 31152 KB Output is correct
39 Correct 1132 ms 31136 KB Output is correct
40 Correct 922 ms 32600 KB Output is correct
41 Correct 753 ms 31564 KB Output is correct
42 Correct 706 ms 31568 KB Output is correct
43 Correct 1358 ms 32748 KB Output is correct
44 Correct 746 ms 26996 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 1060 KB Output is correct
24 Correct 5 ms 3280 KB Output is correct
25 Correct 6 ms 2280 KB Output is correct
26 Correct 4 ms 1488 KB Output is correct
27 Correct 8 ms 3408 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 7 ms 3280 KB Output is correct
30 Correct 21 ms 4352 KB Output is correct
31 Correct 81 ms 29760 KB Output is correct
32 Correct 43 ms 3100 KB Output is correct
33 Correct 13 ms 2152 KB Output is correct
34 Correct 686 ms 20172 KB Output is correct
35 Correct 839 ms 31844 KB Output is correct
36 Correct 93 ms 4804 KB Output is correct
37 Correct 1124 ms 31360 KB Output is correct
38 Correct 1030 ms 31152 KB Output is correct
39 Correct 1132 ms 31136 KB Output is correct
40 Correct 922 ms 32600 KB Output is correct
41 Correct 753 ms 31564 KB Output is correct
42 Correct 706 ms 31568 KB Output is correct
43 Correct 1358 ms 32748 KB Output is correct
44 Correct 746 ms 26996 KB Output is correct
45 Runtime error 2 ms 1756 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -