Submission #373378

# Submission time Handle Problem Language Result Execution time Memory
373378 2021-03-04T11:34:55 Z urd05 Game (IOI14_game) C++14
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
using namespace std;

bool used[80][80];
int n;
int p[80];

int find(int a) {
    if (p[a]<0) {
        return a;
    }
    return p[a]=find(p[a]);
}

void merge(int a,int b) {
    a=find(a);
    b=find(b);
    if (a==b){
        return;
    }
    p[a]+=p[b];
}

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

int hasEdge(int u,int v) {
    used[u][v]=true;
    used[v][u]=true;
    memset(p,-1,sizeof(p));
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            if (!used[i][j]) {
                merge(i,j);
            }
        }
    }
    if (p[find(0)]==-n) {
        return false;
    }
    else {
        used[u][v]=false;
        used[v][u]=false;
        return true;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -