답안 #706972

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
706972 2023-03-08T08:09:42 Z TranGiaHuy1508 CEOI16_icc (CEOI16_icc) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#include "icc.h"

namespace local {
	int n;
	vector<int> V;
	vector<vector<int>> groups;

	void add_edge(int x, int y){
		for (auto i: groups[y]) groups[x].push_back(i);
		groups[y].clear();

		vector<int> newv;
		for (auto i: V) if (i != y) newv.push_back(i);
		V.swap(newv);

		setRoad(x, y);
	}

	void found_solve(vector<int> &g1, vector<int> &g2){
		vector<int> tmp;
		int l = 0, r = g1.size() - 1;
		while (l < r){
			int mid = (l + r) >> 1;
			for (int i = 0; i <= mid; i++) tmp.push_back(g1[i]);
			if (query(tmp.size(), g2.size(), tmp, g2)) r = mid;
			else l = mid + 1;
		}
		if (g2.size() > 1){
			found_solve(g2, g1);
			return;
		}
		add_edge(g1[0], g2[0]);
	}

	void normal_solve(vector<int> &v){
		for (int b = 0; b < 7; b++){
			vector<int> g1, g2;
			
			for (int i = 0; i < (int)v.size(); i++){
				if ((i >> b) & 1){
					for (auto j: groups[v[i]]) g1.push_back(j);
				}
				else{
					for (auto j: groups[v[i]]) g2.push_back(j);
				}
			}

			if (query(g1.size(), g2.size(), g1, g2)){
				found_solve(g1, g2);
				return;
			}
		}
	}
}

void run(int N){
	local::n = N;
	local::groups.resize(local::n + 1);
	local::V.resize(local::n);
	iota(local::V.begin(), local::V.end(), 1);

	for (int i = 0; i < local::n - 1; i++){
		local::normal_solve(local::V);
	}
}

Compilation message

icc.cpp: In function 'void local::found_solve(std::vector<int>&, std::vector<int>&)':
icc.cpp:28:37: error: cannot convert 'std::vector<int>' to 'int*'
   28 |    if (query(tmp.size(), g2.size(), tmp, g2)) r = mid;
      |                                     ^~~
      |                                     |
      |                                     std::vector<int>
In file included from icc.cpp:4:
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: In function 'void local::normal_solve(std::vector<int>&)':
icc.cpp:51:36: error: cannot convert 'std::vector<int>' to 'int*'
   51 |    if (query(g1.size(), g2.size(), g1, g2)){
      |                                    ^~
      |                                    |
      |                                    std::vector<int>
In file included from icc.cpp:4:
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);
      |                         ~~~~~^