답안 #61406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61406 2018-07-25T19:44:09 Z khohko CEOI16_icc (CEOI16_icc) C++17
컴파일 오류
0 ms 0 KB
#include "icc.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pb push_back
#define ARRS ((ll)(2e6+100))
#define MAX ((ll)(2e9+100))

ll a[ARRS];
ll b[ARRS];
ll ca,cb;

ll pr[ARRS];
ll f[ARRS];
vector<ll> v[ARRS];

ll par(ll x){
	if(x==pr[x])return x;
	else return pr[x]=par(pr[x]);
}

void join(ll x,ll y){
	x=par(x);
	y=par(y);
	if(x==y)return;
	pr[y]=x;
}

//void setRoad(ll a,ll b){
//	cout<<"------"<<endl;
//	cout<<"PAS:"<<a<<" "<<b<<endl;
//	cout<<endl;
//}
//ll query(ll n,ll m,ll *a,ll *b){
//	cout<<n<<endl;
//	for(int i=0; i<n; i++)cout<<a[i]<<" \n"[i==n-1];
//	cout<<m<<endl;
//	for(int i=0; i<m; i++)cout<<b[i]<<" \n"[i==m-1];
//	cout<<"????\n";
//	ll k;
//	cin>>k;
//	cout<<endl;
//	return k;
//}



void run(int n){
	for(int i=0; i<n; i++){
		pr[i]=i;
		v[i].pb(i);
	}

	vector<ll> va,vb;
	for(int i=0; i<n-1; i++){
		do{
			for(int i=0; i<n; i++)
				f[i]=0;
			ca=cb=0;
			for(int i=0; i<n; i++){
				if(!f[par(i)])
					f[par(i)]=rand()%2+1;
				if(f[par(i)]==1)a[ca++]=i;
				else b[cb++]=i;
			}
		}
		while(!query(ca,cb,a,b));

		va.clear();
		vb.clear();
		for(int i=0; i<n; i++){
			//if(i==par(i)){
			if(f[par(i)]==1)va.pb(i);
			else vb.pb(i);
			//}
		}
		ll l=1,r=va.size();
		while(l<r){
			ll m=l+r>>1;
			ca=0;
			for(int i=0; i<m; i++){
				//for(auto k:v[va[i]])
				a[ca++]=va[i];
			}
			if(query(ca,cb,a,b))
				r=m;
			else l=m+1;
		}
		ca=1;
		ll x=va[l-1];
		a[0]=x;
		l=1,r=vb.size();
		while(l<r){
			ll m=l+r>>1;
			cb=0;
			for(int i=0; i<m; i++){
				//for(auto k:v[vb[i]])
				b[cb++]=vb[i];
			}
			if(query(ca,cb,a,b))
				r=m;
			else l=m+1;
		}
		ll y=vb[l-1];
		setRoad(x,y);
		join(x,y);
	}

}
//
//int main(){
//	run(5);
//
//
//}




Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:69:25: error: cannot convert 'long long int*' to 'int*' for argument '3' to 'int query(int, int, int*, int*)'
   while(!query(ca,cb,a,b));
                         ^
icc.cpp:81:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    ll m=l+r>>1;
         ~^~
icc.cpp:87:22: error: cannot convert 'long long int*' to 'int*' for argument '3' to 'int query(int, int, int*, int*)'
    if(query(ca,cb,a,b))
                      ^
icc.cpp:96:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    ll m=l+r>>1;
         ~^~
icc.cpp:102:22: error: cannot convert 'long long int*' to 'int*' for argument '3' to 'int query(int, int, int*, int*)'
    if(query(ca,cb,a,b))
                      ^