이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |