# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1083107 | | n1k | Game (IOI14_game) | C++17 | | 1080 ms | 3740 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int N;
int adj[1505][1505], seen[1505];
void dfs(int u){
if(seen[u]) return;
seen[u]=1;
for(int v=0; v<N; v++)
if(adj[u][v])
dfs(v);
}
bool check(){
bool ok = 1;
for(int i=0; i<N; i++){
seen[i]=0;
}
dfs(0);
for(int i=0; i<N; i++){
ok &= seen[i];
}
return ok;
}
void initialize(int n) {
N = n;
for(int i=0; i<N; i++){
for(int j=0; j<N; j++){
adj[i][j]=1;
}
}
}
int hasEdge(int u, int v) {
adj[u][v] = adj[v][u] = 0;
if(check()) return 0;
else {
adj[u][v] = adj[v][u] = 1;
return 1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |