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;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
vi ind(1500);
int comp;
int find(int ac){
if (ind[ac]==ac) return ac;
return find(ind[ac]);
}
void unite(int a, int b){
if (find(a)==find(b)) return;
comp--;
ind[find(a)]=b;
}
vvb preguntas;
set<int> com={0};
void initialize(int n) {
preguntas=vvb(n,vb(n,0));
}
int hasEdge(int u, int v) {
preguntas[u][v]=true;
preguntas[v][u]=true;
if (com.count(u)==com.count(v)) return 0;
else{
if (com.count(u)) swap(u,v);
for (int x:com){
if (not preguntas[u][x]) return 0;
}
com.insert(u);
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... |