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 maxn = 1.5e3 + 20;
bool done[maxn][maxn];
pair<int, int> range[maxn];
int color[maxn][maxn];
int cnt[maxn];
void initialize(int n) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
color[i][j] = -1;
}
}
for (int i = 0; i < n - 1; i++) {
range[i] = make_pair(0, n - 1);
}
}
int hasEdge(int u, int v) {
if (u > v) {
swap(u, v);
}
if (u + 1 == v) {
for (int i = range[u].first; i <= u; i++) {
for (int j = v; j <= range[u].second; j++) {
if (!done[i][j] && color[i][j] == -1) {
color[i][j] = u;
cnt[u]++;
}
}
}
for (int i = range[u].first; i < u; i++) {
range[i].second = u;
}
for (int i = v; i < range[u].second; i++) {
range[i].first = v;
}
}
done[u][v] = true;
if (color[u][v] == -1) {
return 0;
}
cnt[color[u][v]]--;
if (cnt[color[u][v]] == 0) {
return 1;
}
else {
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... |