Submission #731545

# Submission time Handle Problem Language Result Execution time Memory
731545 2023-04-27T14:12:46 Z ogibogi2004 Game (APIO22_game) C++17
2 / 100
5 ms 7248 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])return 0;
        bool flag=set_min(u,v);

        gr[v].push_back(u);
        return flag;
    }
    else if(min_nxt[v]>=min_nxt[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 3 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 4 ms 7248 KB Output is correct
2 Correct 3 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 7236 KB Output is correct
10 Incorrect 5 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 3 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 7236 KB Output is correct
10 Incorrect 5 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 3 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 7236 KB Output is correct
10 Incorrect 5 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 3 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 7236 KB Output is correct
10 Incorrect 5 ms 7248 KB Wrong Answer[1]
11 Halted 0 ms 0 KB -