Submission #302593

#TimeUsernameProblemLanguageResultExecution timeMemory
302593aljasdlasCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

#define int long long
long long find_maximum(signed k, vector<vector<signed>> x) {
	vector<vector<signed>> answer;

	int n = x.size();
	int m = x[0].size();

	// vector<pair<int,int>> v;
	// for(int i = 0; i < n; i++) {
		// v.push_back({x[i], i});
	// }
	// sort(v.begin(), v.end());
	// for(int i = 0; i < n)

	for (int i = 0; i < n; i++) {
		vector<int> row(m);
		for (int j = 0; j < m; j++) {
			if (j < k) {
				row[j] = j;
			} else {
				row[j] = -1;
			}
		}
		answer.push_back(row);
	}
	allocate_tickets(answer);
	return 1;
}

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:29:23: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(std::vector<long long int>&)'
   29 |   answer.push_back(row);
      |                       ^
In file included from /usr/include/c++/9/vector:67,
                 from tickets.h:1,
                 from tickets.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]'
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:35: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'const value_type&' {aka 'const std::vector<int>&'}
 1184 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]'
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:30: note:   no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1200 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~