# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
529855 | aris12345678 | Game (IOI14_game) | C++14 | 0 ms | 0 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 cc[mxN];
bool vis[mxN][mxN];
int N, edges;
void initialize(int n) {
N = n;
edges = 1;
for(int i = 0; i < N; i++) {
cc[i] = 0;
vis[i][i] = true;
if(i == 0) continue;
edges *= i;
}
}
bool hasEdge(int u, int v) {
cc[u]++, cc[v]++;
if(cc[u] == N-1 || cc[v] == N-1 || edges == N-1) {
if(!vis[u][v]) {
vis[u][v] = vis[v][u] = true;
return true;
}
}
edges--;
return false;
}
// int main() {
// int n;
// scanf("%d", &n);
// initialize(n);
// int r = n*(n-1)/2;
// while(r--) {
// int u, v;
// scanf("%d %d", &u, &v);
// bool ok = hasEdge(u, v);
// if(ok)
// printf("yes\n");
// else
// printf("no\n");
// }
// return 0;
// }