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 <bits/stdc++.h>
#include "game.h"
using namespace std;
const int N = 1501;
vector<pair<int,int> > edges;
bitset<N> mark, adj[N];
int cnt_mark;
void initialize(int n) {
}
int hasEdge(int u, int v) {
if(!cnt_mark) {
mark[u] = mark[v] = 1;
cnt_mark = 2;
adj[u][v] = adj[v][u] = true;
return 1;
}
if(!mark[u] && !mark[v]) {
adj[u][v] = adj[v][u] = true;
return 0;
}
if(mark[u]) swap(u, v);
int cnt = (adj[u] & mark).count();
adj[u][v] = adj[v][u] = true;
if(cnt < cnt_mark - 1) return 0;
++cnt_mark;
mark[u] = true;
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |