Submission #644807

# Submission time Handle Problem Language Result Execution time Memory
644807 2022-09-25T09:36:25 Z Tenis0206 Game (APIO22_game) C++17
2 / 100
7 ms 12012 KB
#include <bits/stdc++.h>

#include "game.h"

using namespace std;

int n,k;

int l[500005];

bool ok = false;

vector<int> G[500005];

void init(int N,  int K)
{
    n = N;
    k = K;
    for(int i=0; i<k; i++)
    {
        l[i] = i;
    }
}

void dfs(int nod, int val)
{
    l[nod] = val;
    for(auto it : G[nod])
    {
        if(it < k)
        {
            if(val >= it)
            {
                ok = true;
                break;
            }
            continue;
        }
        if(l[it] >= val)
        {
            continue;
        }
        dfs(it,val);
    }
}

int add_teleporter(int x, int y)
{
    G[x].push_back(y);
    if(x < k && y <= x)
    {
        ok = true;
        return ok;
    }
    if(l[y] < l[x])
    {
        dfs(y,l[x]);
    }
    return ok;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11936 KB Output is correct
2 Correct 6 ms 11984 KB Output is correct
3 Correct 6 ms 11984 KB Output is correct
4 Correct 6 ms 11964 KB Output is correct
5 Correct 6 ms 11984 KB Output is correct
6 Correct 7 ms 11984 KB Output is correct
7 Correct 6 ms 11984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11936 KB Output is correct
2 Correct 6 ms 11984 KB Output is correct
3 Correct 6 ms 11984 KB Output is correct
4 Correct 6 ms 11964 KB Output is correct
5 Correct 6 ms 11984 KB Output is correct
6 Correct 7 ms 11984 KB Output is correct
7 Correct 6 ms 11984 KB Output is correct
8 Correct 6 ms 11984 KB Output is correct
9 Correct 7 ms 11984 KB Output is correct
10 Correct 5 ms 11984 KB Output is correct
11 Incorrect 6 ms 12012 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11936 KB Output is correct
2 Correct 6 ms 11984 KB Output is correct
3 Correct 6 ms 11984 KB Output is correct
4 Correct 6 ms 11964 KB Output is correct
5 Correct 6 ms 11984 KB Output is correct
6 Correct 7 ms 11984 KB Output is correct
7 Correct 6 ms 11984 KB Output is correct
8 Correct 6 ms 11984 KB Output is correct
9 Correct 7 ms 11984 KB Output is correct
10 Correct 5 ms 11984 KB Output is correct
11 Incorrect 6 ms 12012 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11936 KB Output is correct
2 Correct 6 ms 11984 KB Output is correct
3 Correct 6 ms 11984 KB Output is correct
4 Correct 6 ms 11964 KB Output is correct
5 Correct 6 ms 11984 KB Output is correct
6 Correct 7 ms 11984 KB Output is correct
7 Correct 6 ms 11984 KB Output is correct
8 Correct 6 ms 11984 KB Output is correct
9 Correct 7 ms 11984 KB Output is correct
10 Correct 5 ms 11984 KB Output is correct
11 Incorrect 6 ms 12012 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11936 KB Output is correct
2 Correct 6 ms 11984 KB Output is correct
3 Correct 6 ms 11984 KB Output is correct
4 Correct 6 ms 11964 KB Output is correct
5 Correct 6 ms 11984 KB Output is correct
6 Correct 7 ms 11984 KB Output is correct
7 Correct 6 ms 11984 KB Output is correct
8 Correct 6 ms 11984 KB Output is correct
9 Correct 7 ms 11984 KB Output is correct
10 Correct 5 ms 11984 KB Output is correct
11 Incorrect 6 ms 12012 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -