제출 #1356525

#제출 시각아이디문제언어결과실행 시간메모리
1356525coderg300711ICC (CEOI16_icc)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pii pair<int,int>
#define pll pair<long long,long long>
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define pb push_back
#define sz(x) (int)(x).size()
#define rsz resize
#define ass assign
#define F(i,l,r) for(int i=(l);i<(r);++i)
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
template<typename T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define each(a,x) for(auto a:x)
#define FOR(i,a) for(int i=0;i<(a);i++)
#define ROF(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define eb emplace_back
#define ft front()
#define V vector

#include "icc.h"

int ask(V<int>& a,V<int>& b){
	if(a.empty() || b.empty())return 0;
	return query(sz(a),sz(b),(int*)a.data(),(int*)b.data());
}

void run(int N){
V<V<int>> comps(N);
FOR(i,N-1){
	int k=sz(comps),found=-1;
	V<int> v0,v1;
	FOR(b,7){
		V<int> st0,st1;
		FOR(i,k){
			if((i>>b)&1){
				each(city,comps[i])st1.pb(city);
			}else{
				each(city,comps[i])st0.pb(city);
			}
		}
		if(query(st0,st1)){
			found=b;
			v0=st0;
			v1=st1;
			break;
		}
	}
	int lo=0,hi=sz(v0)-1;
	while(lo<hi){
		int mid=(lo+hi)/2;
		V<int> sub;
		FOR(i,mid+1)sub.pb(v0[i]);
		if(query(sub,v1))hi=mid;
		else lo=mid+1;
	}
	int u=v0[lo];
	lo=0,hi=sz(v1)-1;
	V<int> single={u};
	while(lo<hi){
		int mid=(lo+hi)/2;
		V<int> sub;
		FOR(i,mid+1)sub.pb(v1[i]);
		if(query(single,sub))hi=mid;
		else lo=mid+1;
	}
	int v=v1[lo];
	setRoad(u,v);
	int compu=-1,compv=-1;
	FOR(i,sz(comps)){
		each(city,comps[i]){
			if(city==u)compu=i;
			if(city==v)compv=i;
		}
	}
	each(city,comps[compv])comps[compu].pb(city);
	comps.erase(comps.begin()+compv);
}	
}

컴파일 시 표준 에러 (stderr) 메시지

icc.cpp: In function 'void run(int)':
icc.cpp:47:26: error: cannot convert 'std::vector<int>' to 'int'
   47 |                 if(query(st0,st1)){
      |                          ^~~
      |                          |
      |                          std::vector<int>
In file included from icc.cpp:26:
icc.h:10:15: note:   initializing argument 1 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |           ~~~~^
icc.cpp:59:26: error: cannot convert 'std::vector<int>' to 'int'
   59 |                 if(query(sub,v1))hi=mid;
      |                          ^~~
      |                          |
      |                          std::vector<int>
icc.h:10:15: note:   initializing argument 1 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |           ~~~~^
icc.cpp:69:26: error: cannot convert 'std::vector<int>' to 'int'
   69 |                 if(query(single,sub))hi=mid;
      |                          ^~~~~~
      |                          |
      |                          std::vector<int>
icc.h:10:15: note:   initializing argument 1 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |           ~~~~^