제출 #1128937

#제출 시각아이디문제언어결과실행 시간메모리
1128937djs100201게임 (IOI14_game)C++20
0 / 100
23 ms34884 KiB
#include <bits/stdc++.h>
#include "game.h"
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
const ll n_ = 2e3 + 100;
ll checked[n_], con[n_][n_], N;
void initialize(int n) {
    N = n;
    memset(con, -1, sizeof(con));
}
bool go(ll s) {
    vector<ll> checked(N + 1);
    queue<ll> q;
    ll ret = 0;
    q.push(s);
    checked[s] = 1;
    while (q.size()) {
        ll cur = q.front();
        ret++;
        q.pop();
        for (int i = 1; i <= N; i++) {
            if (checked[i] || con[cur][i] == 1) continue;
            checked[i] = 1;
            q.push(i);
        }
    }
    return ret == N;
}
int hasEdge(int u, int v) {
    con[u][v] = 0;
    if (!go(u) || !go(v)) {
        con[u][v] = 1;
    }
    return con[u][v];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...