답안 #957606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957606 2024-04-04T05:13:16 Z vjudge1 게임 (APIO22_game) C++17
2 / 100
7 ms 25432 KB
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'
//#define int long long

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

const int dx[]={-1, 1, 0, 0, 0};
const int dy[]={0, 0, 1, -1, 0};
typedef long long ll;
using namespace std;
const int mx=1e6+12;
const int mod=998244353;
const bool T=1;

vector<int> g[mx];
int used[mx];
int n,m,k;
int timer;
bool ans;

void init(int N, int K) {
    n=N, k=K;
    timer++;
    for(int i=0;i<k-1;i++){
        g[i].push_back(i+1);
    }
}

bool check(int v){
    used[v]=timer;
    for(int to:g[v]){
        if(used[to]==timer){
            return 1;
        }
        if(used[to]<timer && check(to)){
            return 1;
        }
    }
    used[v]=timer+1;
    return 0;
}

int add_teleporter(int u, int v) {
    if(ans){
        return 1;
    }
    g[u].push_back(v);
    for(int i=0;i<k;i++){
        if(used[i]<timer && check(i)){
            ans=1;
            return 1;
        }
    }
    timer+=2;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25432 KB Output is correct
2 Correct 5 ms 25432 KB Output is correct
3 Correct 6 ms 25432 KB Output is correct
4 Correct 6 ms 25432 KB Output is correct
5 Correct 6 ms 25432 KB Output is correct
6 Correct 6 ms 25432 KB Output is correct
7 Correct 6 ms 25432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25432 KB Output is correct
2 Correct 5 ms 25432 KB Output is correct
3 Correct 6 ms 25432 KB Output is correct
4 Correct 6 ms 25432 KB Output is correct
5 Correct 6 ms 25432 KB Output is correct
6 Correct 6 ms 25432 KB Output is correct
7 Correct 6 ms 25432 KB Output is correct
8 Correct 6 ms 25432 KB Output is correct
9 Correct 6 ms 25432 KB Output is correct
10 Correct 6 ms 25432 KB Output is correct
11 Incorrect 6 ms 25432 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25432 KB Output is correct
2 Correct 5 ms 25432 KB Output is correct
3 Correct 6 ms 25432 KB Output is correct
4 Correct 6 ms 25432 KB Output is correct
5 Correct 6 ms 25432 KB Output is correct
6 Correct 6 ms 25432 KB Output is correct
7 Correct 6 ms 25432 KB Output is correct
8 Correct 6 ms 25432 KB Output is correct
9 Correct 6 ms 25432 KB Output is correct
10 Correct 6 ms 25432 KB Output is correct
11 Incorrect 6 ms 25432 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25432 KB Output is correct
2 Correct 5 ms 25432 KB Output is correct
3 Correct 6 ms 25432 KB Output is correct
4 Correct 6 ms 25432 KB Output is correct
5 Correct 6 ms 25432 KB Output is correct
6 Correct 6 ms 25432 KB Output is correct
7 Correct 6 ms 25432 KB Output is correct
8 Correct 6 ms 25432 KB Output is correct
9 Correct 6 ms 25432 KB Output is correct
10 Correct 6 ms 25432 KB Output is correct
11 Incorrect 6 ms 25432 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 25432 KB Output is correct
2 Correct 5 ms 25432 KB Output is correct
3 Correct 6 ms 25432 KB Output is correct
4 Correct 6 ms 25432 KB Output is correct
5 Correct 6 ms 25432 KB Output is correct
6 Correct 6 ms 25432 KB Output is correct
7 Correct 6 ms 25432 KB Output is correct
8 Correct 6 ms 25432 KB Output is correct
9 Correct 6 ms 25432 KB Output is correct
10 Correct 6 ms 25432 KB Output is correct
11 Incorrect 6 ms 25432 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -