답안 #899729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899729 2024-01-06T23:00:47 Z YassirSalama CEOI16_icc (CEOI16_icc) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <limits>
#include <map>
#include <utility>
#include <cctype>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include<assert.h>
#include <functional>
#include <iterator>
#include "icc.h"
using namespace std;
#define OVL(x,s) for(auto y:x) cout<<y<<s; cout<<"\n";
#ifdef IOI
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__);
#else
#define dbg(...) 1337;
#endif
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define ll long long
#define mod 1000000007
#define all(v) v.begin(),v.end()
int ask(vector<int> a,vector<int> b){
	int n=a.size();
	int m=b.size();
	int A[n];
	int B[m];
	for(int i=0;i<n;i++) A[i]=a[i];
	for(int i=0;i<m;i++) B[i]=b[i];
	return query(n,m,A,B);
}
const int MAXN=2e3+100;
int par[MAXN];
struct DSU {
	DSU(){
		for(int i=0;i<MAXN;i++) par[i]=i;
	}
	int find(int node){
		return node==par[node]?node:par[node]=find(par[node]);
	}
	bool same(int a,int b){
		return find(a)==find(b);
	}
	void merge(int a,int b){
		a=find(a);
		b=find(b);
		if(a==b) return;
		par[a]=b;
	}
};
void run(int n){
	DSU dsu=DSU();
	for(int ww=0;ww<n-1;ww++){
		for(int i=1;i<=n;i++){
			vector<int> a;
			vector<int> b;
			a.pb(i);
			for(int j=1;j<=n;j++){
				if(dsu.same(i,j)) continue;
				b.pb(j);
			}
			if(ask(a,b)){
				setRoad(a,b);
				dsu.merge(a,b);
				break;
			}
		}
		// setRoad(1,1);
	}
}

Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:77:13: error: cannot convert 'std::vector<int>' to 'int'
   77 |     setRoad(a,b);
      |             ^
      |             |
      |             std::vector<int>
In file included from icc.cpp:20:
icc.h:11:18: note:   initializing argument 1 of 'void setRoad(int, int)'
   11 | void setRoad(int a, int b);
      |              ~~~~^
icc.cpp:78:15: error: cannot convert 'std::vector<int>' to 'int'
   78 |     dsu.merge(a,b);
      |               ^
      |               |
      |               std::vector<int>
icc.cpp:58:17: note:   initializing argument 1 of 'void DSU::merge(int, int)'
   58 |  void merge(int a,int b){
      |             ~~~~^