# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
835098 | _martynas | Game (IOI14_game) | C++11 | 1086 ms | 532 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;
const int mxn = 1505;
int n;
bitset<mxn> adj[mxn];
void initialize(int N) {
n = N;
for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) {
if(i != j) adj[i][j] = 1;
}
}
bitset<mxn> visited;
// check if it can be connected
void dfs_could(int u) {
visited[u] = true;
for(int v = 0; v < n; v++) if(!visited[v]) {
if(adj[u][v]) {
dfs_could(v);
}
}
}
int hasEdge(int u, int v) {
bool resp = false;
visited.reset();
adj[u][v] = adj[v][u] = false;
dfs_could(0);
if(visited.count() != n) {
resp = true;
adj[u][v] = adj[v][u] = true;
}
return resp;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |