# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51349 | classe88 | 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.
//https://oj.uz/problem/view/IOI14_game
#include <iostream>
#define N 1500
using namespace std;
int A[N][N];
int sum[N];
int n;
int hasEdge(int u, int v) {
if (u < v)
return hasEdge(v, u);
if (sum[u] == n - u) {
A[u][v] = 1;
return 1;
}
else {
sum[u] += 1;
return 0;
}
}
void initialize(int k) {
n = k;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
A[i][j] = 0;
}
sum[i] = 0;
}
}
int main() {
int n;
cin >> n;
initialize(n);
for (int i = 0; i < n*(n-1)/2; i++) {
int u, v;
cin >> u >>v;
hasEdge(u, v);
}
return 0;
}