Submission #892572

# Submission time Handle Problem Language Result Execution time Memory
892572 2023-12-25T14:07:23 Z vjudge1 Super Dango Maker (JOI22_dango3) C++17
Compilation error
0 ms 0 KB
#include "dango3.h"

#include <vector>

#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

using namespace std;

void rec(vector<int> &v, int m){
	if(m == 1){
		Answer(v);
		return;
	}
	
	vector<int> new_v;
	for(int i = 0; i < (int)v.size(); i++){
		new_v.pb(v.begin());
		v.erase(v.begin());
		int x = Query(v);
		if(x < m/2){
			v.pb(new_v.back());
			new_v.pop_back();
		}
	}
	rec(v, m/2);
	rec(new_v, m - m/2);
}

void Solve(int n, int m) {
	vector<int> a;
	for(int i = 1; i <= n * m; i++) a.pb(i);
	rec(a, m);
}

Compilation message

dango3.cpp: In function 'void rec(std::vector<int>&, int)':
dango3.cpp:23:21: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>::iterator)'
   23 |   new_v.pb(v.begin());
      |                     ^
In file included from /usr/include/c++/10/vector:67,
                 from dango3.h:1,
                 from dango3.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::vector<int>::iterator' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::vector<int>::iterator' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~