# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
923526 | alexander707070 | 카멜레온의 사랑 (JOI20_chameleon) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h>
#include "chameleon.h"
#define MAXN 1007
namespace {
int n;
} // namespace
vector<int> to[MAXN];
void Solve(int N) {
n=N;
for(int i=1;i<=2*n;i++){
for(int f=i+1;f<=2*n;f++){
if(Query({i,f})==1){
to[i].push_back(f);
to[f].push_back(i);
}
}
}
for(int i=1;i<=2*n;i++){
if(to[i].size()==1){
if(i<to[i][0])Answer(i,to[i][0]);
}else{
for(int f:to[to[i][0]]){
if(f==i and i<to[i][0])Answer(i,to[i][0]);
}
for(int f:to[to[i][1]]){
if(f==i and i<to[i][1])Answer(i,to[i][1]);
}
}
}
}