답안 #644807

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
644807 2022-09-25T09:36:25 Z Tenis0206 게임 (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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -