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 = 1505;
int n;
vector<vector<bool>> adj(maxn, vector<bool>(maxn, 0));
map<vector<bool>, int> mp;
vector<int> cnt(maxn, 0);
void initialize(int N) {
n = N;
adj.resize(n);
for (int i=0;i<n;i++) {
adj[i].resize(n);
}
cnt.resize(n);
}
int hasEdge(int u, int v) {
adj[u][v] = adj[v][u] = 1;
mp[adj[u]]++, mp[adj[v]]++;
cnt[u]++, cnt[v]++;
// cout << mp[adj[u]] << " " << mp[adj[v]] << endl;
// cout << cnt[u] << " " << cnt[v] << endl;
if (n-mp[adj[u]] == cnt[u] || n-mp[adj[v]] == cnt[v]) {
mp[adj[u]]--, mp[adj[v]]--;
adj[u][v] = adj[v][u] = 0;
cnt[u]--, cnt[v]--;
return true;
}
return false;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |