답안 #224443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
224443 2020-04-17T22:55:04 Z kshitij_sodani 카멜레온의 사랑 (JOI20_chameleon) C++17
40 / 100
25 ms 384 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
#include "chameleon.h"
/*int Query(vector<int> cc){
	for(auto nn:cc){
		cout<<nn<<",";
	}
	cout<<endl;
	int xx;
	cin>>xx;
	return xx;
}
void Answer(int ac,int cd){
	cout<<ac<<" "<<cd<<endl;
}*/
 
void Solve(int n){
	int vis[2*n];
	for(int i=0;i<2*n;i++){
		vis[i]=0;
	}
	vector<pair<int,int>> kk;
	for(int i=0;i<2*n;i++){
		if(vis[i]==0){
			vector<int> aa;
			for(int j=0;j<2*n;j++){
				if(i==j){
					continue;
				}
				int x=Query({i+1,j+1});
				if(x==1){
					aa.pb(j+1);
				}
			}
 
			if(aa.size()==1){
				vis[i]=1;
				vis[aa[0]-1]=1;
 
				kk.pb({i+1,aa[0]});
			}
			else{
				vector<int> cc;
				for(int j=0;j<2;j++){
					for(int k=j+1;k<3;k++){
						if(Query({i+1,aa[j],aa[k]})==1){
							//aa.clear();
							cc={aa[j],aa[k]};
						}
					}
				}
				aa=cc;
				vector<int> bb;
				for(int j=0;j<2*n;j++){
					if(j!=i and j!=aa[0]-1){
						bb.pb(j+1);
					}
				}
				int x=Query(bb);
				if(x==n){
					vis[i]=1;
					vis[aa[1]-1]=1;
					kk.pb({i+1,aa[1]});
				}
				else{
					vis[i]=1;
					vis[aa[0]-1]=1;
					kk.pb({i+1,aa[0]});
				}
			}
		}
	}
	for(auto nn:kk){
		Answer(nn.a,nn.b);
	}
}
/*int main(){
	Solve(3);
	return 0;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 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 5 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 5 ms 308 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 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 5 ms 308 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 6 ms 384 KB Output is correct
13 Correct 6 ms 384 KB Output is correct
14 Correct 6 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 6 ms 384 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 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 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 25 ms 384 KB Wrong Answer [3]
4 Halted 0 ms 0 KB -