답안 #582527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
582527 2022-06-24T03:45:12 Z MurotY 게임 (APIO22_game) C++17
2 / 100
16 ms 23880 KB
#include <bits/stdc++.h>
#define ll long long
#include "game.h"
using namespace std;
const int N=1e6+7;
vector <ll> g[N];
ll used[N], sz;
void init(int n, int k) {
    for (int i=0;i<k-1;i++){
        g[i].push_back(i+1);
    }
    sz=k;
}

int add_teleporter(int u, int v) {
    if (u == v && u < sz) return 1;
    else if (u == v) return 0;
    g[u].push_back(v);

    bool ok=0;
    fill(used, used+10000, 0);
    function <void(ll,ll)> dfs = [&] (ll v, ll p){
        used[v]=1;
        for (auto l:g[v]){
            if (used[l] == 0) dfs(l, v);
            else if (used[l] == 1 && l != p){
                ok=1;
                return ;
            }
        }
        used[v]=2;
    };
    dfs(1, 0);
    if (ok) return 1;
    else return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23740 KB Output is correct
2 Correct 13 ms 23760 KB Output is correct
3 Correct 16 ms 23780 KB Output is correct
4 Correct 13 ms 23760 KB Output is correct
5 Correct 13 ms 23880 KB Output is correct
6 Correct 12 ms 23760 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23740 KB Output is correct
2 Correct 13 ms 23760 KB Output is correct
3 Correct 16 ms 23780 KB Output is correct
4 Correct 13 ms 23760 KB Output is correct
5 Correct 13 ms 23880 KB Output is correct
6 Correct 12 ms 23760 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 13 ms 23760 KB Output is correct
10 Correct 14 ms 23760 KB Output is correct
11 Incorrect 15 ms 23760 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23740 KB Output is correct
2 Correct 13 ms 23760 KB Output is correct
3 Correct 16 ms 23780 KB Output is correct
4 Correct 13 ms 23760 KB Output is correct
5 Correct 13 ms 23880 KB Output is correct
6 Correct 12 ms 23760 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 13 ms 23760 KB Output is correct
10 Correct 14 ms 23760 KB Output is correct
11 Incorrect 15 ms 23760 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23740 KB Output is correct
2 Correct 13 ms 23760 KB Output is correct
3 Correct 16 ms 23780 KB Output is correct
4 Correct 13 ms 23760 KB Output is correct
5 Correct 13 ms 23880 KB Output is correct
6 Correct 12 ms 23760 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 13 ms 23760 KB Output is correct
10 Correct 14 ms 23760 KB Output is correct
11 Incorrect 15 ms 23760 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 23740 KB Output is correct
2 Correct 13 ms 23760 KB Output is correct
3 Correct 16 ms 23780 KB Output is correct
4 Correct 13 ms 23760 KB Output is correct
5 Correct 13 ms 23880 KB Output is correct
6 Correct 12 ms 23760 KB Output is correct
7 Correct 13 ms 23760 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 13 ms 23760 KB Output is correct
10 Correct 14 ms 23760 KB Output is correct
11 Incorrect 15 ms 23760 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -