답안 #410266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
410266 2021-05-22T11:42:59 Z Blagojce CEOI16_icc (CEOI16_icc) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define st first
#define nd second
#define all(v) begin(v), end(v)
#define pq priority_queue
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int mxn = 2e2;

mt19937 _rand(time(NULL));

#include "icc.h"



int link[mxn];
int siz[mxn];
int n;

int findx(int x){
	if(x == link[x]) return x;
	link[x] = findx(link[x]);
	return link[x];
}

void unite(int a, int b){
	a = findx(a);
	b = findx(b);
	if(a == b) return;
	
	if(siz[a] < siz[b]) swap(a, b);
	siz[a] += siz[b];
	link[b] = a;
}



vector<int> unzip(vector<int> v){
	fr(i, 0, n){
		if(find(all(v), findx(i)) != v.end()) v.pb(i);
	}
	return v;
}

void separation(vector<int> v, vector<int> &a, vector<int> &b){
	do{
		a.clear();
		b.clear();
		for(auto u : v){
			if(_rand()%2) a.pb(u);
			else b.pb(u);
		}
		
		vector<int> ua = unzip(a);
		vector<int> ub = unzip(b);
		
	}while(!query((int)ua.size(), (int)ub.size(), ua, ub));
}

int findvertex(vector<int> v, vector<int> stat){
	if((int)v.size() == 1){
		return v[0];
	}
	vector<int> lh;
	vector<int> rh;
	fr(i, 0, (int)v.size()/2){
		lh.pb(v[i]);
	}
	fr(i,(int)v.size()/2, (int)v.size()){
		rh.pb(v[i]);
	}
	if(query((int)lh.size(), (int)stat.size(), lh, stat)){
		return findvertex(lh, stat);
	}
	else{
		return findvertex(rh, stat);
	}
}
void run(int N){
	n = N;
	fr(i, 0, n) link[i] = i, siz[i] = 1;
	fr(i, 0, n-1){
		vector<int> v;
		fr(p, 0, n){
			v.pb(findx(p));
		}
		sort(all(v));
		v.erase(unique(all(v)),v.end());
		
		vector<int> v1;
		vector<int> v2;
		separation(v, v1, v2);
		
		v1 = unzip(v1);
		v2 = unzip(v2);
		
		int U = findvertex(v1, v2);
		int V = findvertex(v2,{U});
		
		setRoad(U, V);
	}
}

Compilation message

icc.cpp: In function 'void separation(std::vector<int>, std::vector<int>&, std::vector<int>&)':
icc.cpp:64:21: error: 'ua' was not declared in this scope; did you mean 'a'?
   64 |  }while(!query((int)ua.size(), (int)ub.size(), ua, ub));
      |                     ^~
      |                     a
icc.cpp:64:37: error: 'ub' was not declared in this scope; did you mean 'b'?
   64 |  }while(!query((int)ua.size(), (int)ub.size(), ua, ub));
      |                                     ^~
      |                                     b
icc.cpp: In function 'int findvertex(std::vector<int>, std::vector<int>)':
icc.cpp:79:45: error: cannot convert 'std::vector<int>' to 'int*'
   79 |  if(query((int)lh.size(), (int)stat.size(), lh, stat)){
      |                                             ^~
      |                                             |
      |                                             std::vector<int>
In file included from icc.cpp:19:
icc.h:10:30: note:   initializing argument 3 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |                         ~~~~~^
icc.cpp:71:14: warning: control reaches end of non-void function [-Wreturn-type]
   71 |  vector<int> lh;
      |              ^~