제출 #1225885

#제출 시각아이디문제언어결과실행 시간메모리
1225885kl0989e게임 (IOI14_game)C++20
42 / 100
1097 ms9428 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()

const int maxn=1510;

int n;
vector<vi> graph(maxn,vi(maxn,-1));
vi seen(maxn,0);
int s=0;

void initialize(int _n) {
    n=_n;
}

void dfs(int cur) {
    seen[cur]=1;
    s++;
    for (int i=0; i<n; i++) {
        if (!seen[i] && graph[cur][i]!=0) {
            dfs(i);
        }
    }
}

int hasEdge(int u, int v) {
    graph[u][v]=0;
    graph[v][u]=0;
    fill(all(seen),0);
    s=0;
    dfs(0);
    if (s==n) {
        return 0;
    }
    graph[u][v]=1;
    graph[v][u]=1;
    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...