제출 #779087

#제출 시각아이디문제언어결과실행 시간메모리
779087fatemetmhr게임 (IOI14_game)C++17
42 / 100
1077 ms4424 KiB
//  ~ Be Name Khoda ~  //

#include "game.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  2e3   + 10;
const int maxnt =  1.2e6 + 10;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

int n;
bool mark[maxn5], av[maxn5][maxn5];

void dfs(int v){
    mark[v] = true;
    for(int i = 0; i < n; i++) if(!mark[i] && av[v][i])
        dfs(i);
}


void initialize(int nn) {
    n = nn;
    memset(av, true, sizeof av);
}

int hasEdge(int u, int v){
    av[u][v] = av[v][u] = false;
    memset(mark, false, sizeof mark);
    dfs(0);
    bool ok = true;
    for(int i = 0; i < n; i++)
        ok &= mark[i];
    if(ok)
        return 0;
    av[u][v] = av[v][u] = true;
    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...