Submission #731546

# Submission time Handle Problem Language Result Execution time Memory
731546 2023-04-27T14:13:27 Z ogibogi2004 Game (APIO22_game) C++17
60 / 100
4000 ms 24976 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=3e5+6;
int min_nxt[MAXN];
vector<int>gr[MAXN];
int n,k;
void init(int _n, int _k) {
    n=_n;k=_k;
    for(int i=0;i<n;i++)
    {
        min_nxt[i]=n+1;
    }
}
bool set_min(int u,int val)
{
    min_nxt[u]=val;
    if(u<k&&min_nxt[u]<=u)return 1;
    for(auto xd:gr[u])
    {
        if(min_nxt[xd]>val)
        {
            bool flag=set_min(xd,val);
            if(flag==1)return 1;
        }
    }
    return 0;
}
int add_teleporter(int u, int v) {
    if(u<k&&v<k)
    {
        if(u>=v)return 1;
        else return 0;
    }
    if(v<k)
    {
        if(v>=min_nxt[u])
        {
            gr[v].push_back(u);
            return 0;
        }
        bool flag=set_min(u,v);

        gr[v].push_back(u);
        return flag;
    }
    else if(min_nxt[v]>=min_nxt[u])
    {
        gr[v].push_back(u);
        return 0;
    }
    bool flag=set_min(u,min_nxt[v]);

    gr[v].push_back(u);
    return flag;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 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 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 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 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7264 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 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 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7264 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 4 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 4 ms 7376 KB Output is correct
23 Correct 4 ms 7356 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 8 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7388 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 5 ms 7376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 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 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7264 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 4 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 4 ms 7376 KB Output is correct
23 Correct 4 ms 7356 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 8 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7388 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 5 ms 7376 KB Output is correct
30 Correct 17 ms 8008 KB Output is correct
31 Correct 8 ms 7632 KB Output is correct
32 Correct 22 ms 9068 KB Output is correct
33 Correct 16 ms 8392 KB Output is correct
34 Correct 475 ms 9972 KB Output is correct
35 Correct 185 ms 8868 KB Output is correct
36 Correct 26 ms 8300 KB Output is correct
37 Correct 25 ms 8268 KB Output is correct
38 Correct 24 ms 8356 KB Output is correct
39 Correct 24 ms 8300 KB Output is correct
40 Correct 403 ms 9692 KB Output is correct
41 Correct 88 ms 8520 KB Output is correct
42 Correct 61 ms 8412 KB Output is correct
43 Correct 33 ms 9812 KB Output is correct
44 Correct 460 ms 9852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 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 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 4 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7264 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 4 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 4 ms 7376 KB Output is correct
23 Correct 4 ms 7356 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 8 ms 7376 KB Output is correct
26 Correct 6 ms 7376 KB Output is correct
27 Correct 6 ms 7388 KB Output is correct
28 Correct 5 ms 7376 KB Output is correct
29 Correct 5 ms 7376 KB Output is correct
30 Correct 17 ms 8008 KB Output is correct
31 Correct 8 ms 7632 KB Output is correct
32 Correct 22 ms 9068 KB Output is correct
33 Correct 16 ms 8392 KB Output is correct
34 Correct 475 ms 9972 KB Output is correct
35 Correct 185 ms 8868 KB Output is correct
36 Correct 26 ms 8300 KB Output is correct
37 Correct 25 ms 8268 KB Output is correct
38 Correct 24 ms 8356 KB Output is correct
39 Correct 24 ms 8300 KB Output is correct
40 Correct 403 ms 9692 KB Output is correct
41 Correct 88 ms 8520 KB Output is correct
42 Correct 61 ms 8412 KB Output is correct
43 Correct 33 ms 9812 KB Output is correct
44 Correct 460 ms 9852 KB Output is correct
45 Correct 173 ms 14152 KB Output is correct
46 Correct 8 ms 8648 KB Output is correct
47 Correct 8 ms 8656 KB Output is correct
48 Correct 191 ms 24976 KB Output is correct
49 Correct 169 ms 17792 KB Output is correct
50 Execution timed out 4024 ms 20240 KB Time limit exceeded
51 Halted 0 ms 0 KB -