# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
284167 | | Ozy | Game (IOI14_game) | C++17 | | 696 ms | 25368 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;
#define lli long long int
#define rep(i,a,b) for (lli i = (a); i <= (b); i++)
#define debug(a) cerr << #a << " = " << a << endl;
set<int> avenida;
int tabla[1502][1502];
void initialize(int n) {
avenida.insert(0);
}
int hasEdge(int u, int v) {
int a,c = 0;
if (avenida.find(u) != avenida.end()) c++;
if (avenida.find(v) != avenida.end()) c++;
if (c == 2 || c == 0){
tabla[u][v] = -1;
tabla[v][u] = -1;
return 0;
}
else {
if (avenida.find(u) == avenida.end()) a = u;
else a = v;
c = 0;
for (auto it = avenida.begin(); it != avenida.end(); it++) if (tabla[a][*it] == 0) c++;
if (c == 1) {
tabla[u][v] = 1;
tabla[v][u] = 1;
avenida.insert(a);
return 1;
}
else {
tabla[u][v] = -1;
tabla[v][u] = -1;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |