Submission #399393

#TimeUsernameProblemLanguageResultExecution timeMemory
399393phathnv게임 (IOI14_game)C++11
42 / 100
106 ms1936 KiB
#include "game.h"

const int N = 80;

int n, adj[N][N];
bool vst[N];

void Dfs(int u){
    if (vst[u])
        return;
    vst[u] = 1;
    for(int v = 0; v < n; v++)
        if (adj[u][v])
            Dfs(v);
}

void initialize(int _n){
    n = _n;
    for(int u = 0; u < n; u++)
        for(int v = 0; v < n; v++)
            adj[u][v] = 1;
}

int hasEdge(int u, int v){
    for(int i = 0; i < n; i++)
        vst[i] = 0;
    adj[u][v] = adj[v][u] = 0;
    Dfs(u);
    if (!vst[v])
        adj[u][v] = adj[v][u] = 1;
    return adj[u][v];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...