# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290602 | georgerapeanu | Game (IOI14_game) | C++11 | 588 ms | 25336 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"
#pragma once
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> active;
vector<int> gr;
int adj[1505][1505];
int gl_n;
void initialize(int n) {
gl_n = n;
active = vector<int>(n,0);
gr = vector<int>(n,1);
active[0] = 1;
gr[0] = 0;
}
int hasEdge(int u, int v) {
adj[u][v] = 1;
adj[v][u] = 1;
if(active[v] == 1){
swap(u,v);
}
if(active[u] == 0){
return false;
}
if(active[v] == 1){
return false;
}
if(gr[v] > 1){
gr[v]--;
return false;
}
active[v] = true;
for(int i = 0;i < gl_n;i++){
if(active[i] == 0 && adj[v][i] == 0){
gr[i]++;
}
}
return true;
}
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... |