이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int q[10003];
int con[10003];
int N;
void initialize(int n){
N=n;
}
/*
The key idea is simple: Build a tree and that's it. Find a way to build a tree so that, up until the
penultimate query, is not yet a tree.
Could be done in many ways: the DSU that only connects the final edges between 2 components, the kind of thing
mentioned in the editorial, or.......find a way to seperate all kinds of edges into N-1 non-intersecting sets,
then answering YES to the final edge that belongs to each individual set.
Instead of following the big-brain thing of the editorial........any method of seperating the edges into N-1
non-intersecting sets, where only the final edge that belongs to each set is added, and no cycles are formed
would do.
....okay, the kind of partitioning in the editorial is pretty smart, still thinking of a more original, hyper
clownery way
cant
*/
int hasEdge(int u, int v){
if(v>u){
swap(u,v);
}
q[u-v]++;
return (q[u-v]==N-u-v);
//totally didn't randomly forget that the cities are numbered 0...N-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... |