답안 #212365

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
212365 2020-03-22T19:13:33 Z Abdullah 카멜레온의 사랑 (JOI20_chameleon) C++17
0 / 100
25 ms 384 KB
//~ #include "chameleon.h"
//~ #include <bits/stdc++.h>
//~ using namespace std;
//~ int n;
//~ int get(int x, int l ,int r, int y){
	//~ vector<int>p;
	//~ if(y!=-1){
		//~ for(int i=l; i<=r; i++)p.push_back(i);
		//~ p.push_back(y);
		//~ return Query(p);
	//~ }else if(x==-1){
		//~ for(int i=l; i<=r; i++)	p.push_back(i);
		//~ return Query(p);
	//~ }else{
		//~ for(int i=l ; i<=r; i++){
			//~ if(i==x)continue;
			//~ p.push_back(i);
		//~ }
		//~ return Query(p);
	//~ }
//~ }
//~ int rec(int x, int l, int r){
	//~ int m=(l+r)/2;
	//~ if(l==r)	return l;
	//~ if(x<=m){
		//~ if(get(x, 1, m, -1)==get(-1, 1, m, -1))	return rec(x, 1, m);
		//~ else return rec(x, m+1, r);
	//~ }else{
		//~ if(get(-1, 1, m, -1)==get(-1, 1, m, x)) return rec(x, 1, m);
		//~ else return rec(x, m+1, r);
	//~ }
//~ }
//~ void Solve(int N) {
	//~ n=N*2;
	//~ vector<bool>vis(n+1);
	//~ for(int i=1; i<=n; i++){
		//~ if(vis[i])continue;
		//~ int j=rec(i, 1, n);
		//~ Answer(i, j);
		//~ vis[i]=1, vis[j]=1;
	//~ }
//~ }
#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int n) {
	n*=2;
	vector<vector<int>>adjs(n+1);
	vector<int>sizs(n+1, 0);
	for(int i=1; i<=n; i++){
		for(int j=i+1; j<=n; j++){
			if(Query({i, j})==1){
				adjs[i].push_back(j);
				adjs[j].push_back(i);
			}
		}
	}
	vector<bool>vis(n+1, 0);
	vector<vector<int>>B(n+1);
	for(int i=1; i<=n; i++){
		if(vis[i])continue;
		if(adjs[i].size()==1){
			Answer(i, adjs[i][0]);
			vis[i]=1; 
			vis[adjs[i][0]]=1;
		}else{
			for(int j=0; j<3; j++){
				vector<int>A={i};
				for(int a=0;a<=2; a++){
					if(a!=j)A.push_back(adjs[i][a]);
				}
				if(Query(A)==1){
					B[i].push_back(adjs[i][j]);
					B[adjs[i][j]].push_back(i);
					break;
				}
			}
		}
	}
	for(int i=1; i<=n; i++){
		if(vis[i])continue;
		for(int a:adjs[i]){
			if(a!=B[i][0]&&a!=B[i][1]){
				Answer(i, a);
				vis[i]=1, vis[a]=1;
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 24 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Incorrect 5 ms 384 KB Wrong Answer [5]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Incorrect 5 ms 384 KB Wrong Answer [5]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 25 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Incorrect 24 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -