답안 #423944

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
423944 2021-06-11T14:23:20 Z errorgorn 카멜레온의 사랑 (JOI20_chameleon) C++17
컴파일 오류
0 ms 0 KB
#include "chameleon.h"

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'

#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back

#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n;

vector<int> same[1005];
int nxt[1005];

void Solve(int N) {
	n=N;
	
	
	if (n<=50){
		rep(x,1,2*n+1){
			rep(y,x+1,2*n+1) if (Query({x,y})==1){
				same[x].pub(y);
				same[y].pub(x);
			}
		}
	}
	else{
		//ok we just need to find stuff in the same arrays quickly
		//since we know where the males are, we can bsta the females
		
		rep(x,1,n+1){
			while (true){
				vector<int> v;
				rep(y,n+1,2*n+1){
					bool can=true;
					for (auto &it:same[x]) if (y==it) can=false;
					if (can) v.pub(y);
				}
				
				v.pub(x);
				if (Query(v)==sz(v)) break;
				v.pob();
				
				while (sz(v)!=1){
					vector<int> l,r;
					
					rep(x,0,sz(v)/2) l.pub(v[x]);
					rep(x,sz(v)/2,sz(v)) r.pub(v[x]);
					
					 
	
	memset(nxt,-1,sizeof(nxt));
	
	rep(x,1,2*n+1) if (sz(same[x])==3){
		if (Query({x,same[x][0],same[x][1]})==1){
			nxt[x]=same[x][2];
		}
		if (Query({x,same[x][0],same[x][2]})==1){
			nxt[x]=same[x][1];
		}
		if (Query({x,same[x][1],same[x][2]})==1){
			nxt[x]=same[x][0];
		}
	}
	
	rep(x,1,2*n+1){
		if (sz(same[x])==1){
			//cout<<x<<" "<<same[x][0]<<endl;
			if (x<same[x][0]) Answer(x,same[x][0]);
		}
		else{
			for (auto &it:same[x]) if (nxt[it]!=x && nxt[x]!=it){
				//cout<<x<<" "<<it<<endl;
				if (x<it) Answer(x,it);
			}
		}
	}
}

Compilation message

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:91:1: error: expected '}' at end of input
   91 | }
      | ^
chameleon.cpp:45:16: note: to match this '{'
   45 |    while (true){
      |                ^
chameleon.cpp:91:1: error: expected '}' at end of input
   91 | }
      | ^
chameleon.cpp:44:15: note: to match this '{'
   44 |   rep(x,1,n+1){
      |               ^
chameleon.cpp:91:1: error: expected '}' at end of input
   91 | }
      | ^
chameleon.cpp:40:6: note: to match this '{'
   40 |  else{
      |      ^
chameleon.cpp:91:1: error: expected '}' at end of input
   91 | }
      | ^
chameleon.cpp:28:19: note: to match this '{'
   28 | void Solve(int N) {
      |                   ^