# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
835049 | _martynas | Game (IOI14_game) | C++11 | 2 ms | 600 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;
int deg[mxn];
bool resp[mxn][mxn];
bool adj[mxn][mxn];
void initialize(int N) {
n = N;
for(int i = 0; i < n; i++) deg[i] = n-1;
}
int hasEdge(int u, int v) {
if(adj[u][v]) return true;
queue<int> q;
deg[u]--; if(deg[u] == 1) q.push(u);
deg[v]--; if(deg[v] == 1) q.push(v);
resp[u][v] = resp[v][u] = true;
while(!q.empty()) {
int i = q.front(); q.pop();
for(int j = 0; j < n; j++) if(i != j && !resp[i][j] && !adj[i][j]) {
adj[i][j] = adj[j][i] = true;
deg[j]--; if(deg[j] == 1) q.push(j);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |