Submission #731561

# Submission time Handle Problem Language Result Execution time Memory
731561 2023-04-27T14:33:58 Z ogibogi2004 Game (APIO22_game) C++17
60 / 100
4000 ms 25020 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=3e5+6;
const int SQ=600;
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;
}
void add_edge(int v,int u)
{
    if(gr[u].size()>SQ||gr[u].size()==0)
    {
        gr[v].push_back(u);
        return;
    }
    gr[v].push_back(u);
    for(auto xd:gr[u])gr[v].push_back(xd);
}
int add_teleporter(int u, int v) {
    add_edge(v,u);
    if(u<k&&v<k)
    {
        if(u>=v)return 1;
        else return 0;
    }
    if(v<k)
    {
        if(v>=min_nxt[u])
        {
            //add_edge(v,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 4 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 3 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7328 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 7248 KB Output is correct
4 Correct 3 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7328 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 5 ms 7248 KB Output is correct
12 Correct 4 ms 7328 KB Output is correct
13 Correct 5 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 4 ms 7248 KB Output is correct
17 Correct 6 ms 7248 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 4 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 3 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7328 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 5 ms 7248 KB Output is correct
12 Correct 4 ms 7328 KB Output is correct
13 Correct 5 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 4 ms 7248 KB Output is correct
17 Correct 6 ms 7248 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 5 ms 7360 KB Output is correct
23 Correct 4 ms 7376 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 7 ms 7488 KB Output is correct
27 Correct 6 ms 7408 KB Output is correct
28 Correct 7 ms 7504 KB Output is correct
29 Correct 6 ms 7504 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 7248 KB Output is correct
4 Correct 3 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7328 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 5 ms 7248 KB Output is correct
12 Correct 4 ms 7328 KB Output is correct
13 Correct 5 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 4 ms 7248 KB Output is correct
17 Correct 6 ms 7248 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 5 ms 7360 KB Output is correct
23 Correct 4 ms 7376 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 7 ms 7488 KB Output is correct
27 Correct 6 ms 7408 KB Output is correct
28 Correct 7 ms 7504 KB Output is correct
29 Correct 6 ms 7504 KB Output is correct
30 Correct 21 ms 8016 KB Output is correct
31 Correct 7 ms 7632 KB Output is correct
32 Correct 19 ms 9008 KB Output is correct
33 Correct 21 ms 8476 KB Output is correct
34 Correct 576 ms 9732 KB Output is correct
35 Correct 218 ms 9356 KB Output is correct
36 Correct 29 ms 8600 KB Output is correct
37 Correct 27 ms 8440 KB Output is correct
38 Correct 37 ms 8748 KB Output is correct
39 Correct 30 ms 8740 KB Output is correct
40 Correct 472 ms 14752 KB Output is correct
41 Correct 113 ms 9948 KB Output is correct
42 Correct 74 ms 8716 KB Output is correct
43 Correct 43 ms 9840 KB Output is correct
44 Correct 567 ms 10280 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 7248 KB Output is correct
4 Correct 3 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7328 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 5 ms 7248 KB Output is correct
12 Correct 4 ms 7328 KB Output is correct
13 Correct 5 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 4 ms 7248 KB Output is correct
17 Correct 6 ms 7248 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 5 ms 7360 KB Output is correct
23 Correct 4 ms 7376 KB Output is correct
24 Correct 6 ms 7376 KB Output is correct
25 Correct 7 ms 7376 KB Output is correct
26 Correct 7 ms 7488 KB Output is correct
27 Correct 6 ms 7408 KB Output is correct
28 Correct 7 ms 7504 KB Output is correct
29 Correct 6 ms 7504 KB Output is correct
30 Correct 21 ms 8016 KB Output is correct
31 Correct 7 ms 7632 KB Output is correct
32 Correct 19 ms 9008 KB Output is correct
33 Correct 21 ms 8476 KB Output is correct
34 Correct 576 ms 9732 KB Output is correct
35 Correct 218 ms 9356 KB Output is correct
36 Correct 29 ms 8600 KB Output is correct
37 Correct 27 ms 8440 KB Output is correct
38 Correct 37 ms 8748 KB Output is correct
39 Correct 30 ms 8740 KB Output is correct
40 Correct 472 ms 14752 KB Output is correct
41 Correct 113 ms 9948 KB Output is correct
42 Correct 74 ms 8716 KB Output is correct
43 Correct 43 ms 9840 KB Output is correct
44 Correct 567 ms 10280 KB Output is correct
45 Correct 162 ms 14544 KB Output is correct
46 Correct 9 ms 8656 KB Output is correct
47 Correct 8 ms 8656 KB Output is correct
48 Correct 222 ms 25020 KB Output is correct
49 Correct 222 ms 17948 KB Output is correct
50 Execution timed out 4025 ms 20260 KB Time limit exceeded
51 Halted 0 ms 0 KB -