Submission #1043105

#TimeUsernameProblemLanguageResultExecution timeMemory
1043105MarwenElarbiCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; #define pb push_back #define se second #define fi first long long find_maximum(int K, std::vector<std::vector<int>> x) { long long n = x.size(); int m = x[0].size(); int k=K; vectpr<vector<long long>> y=x; vector<vector<int>> ans(n,vector<int> (m,-1)); priority_queue<pair<long long,int>> pq; long long res=0; for (int i = 0; i < n; ++i) { for (int j = 0; j < k; ++j) { res-=y[i][j]; } } int l[n]; int r[n]; for (int i = 0; i < n; ++i) { l[i]=k-1; r[i]=m-1; pq.push({y[i][l[i]--]+y[i][r[i]--],i}); } for (int i = 0; i < k*n/2; ++i) { auto cur=pq.top(); res+=cur.fi; pq.pop(); if(l[cur.se]==-1||r[cur.se]==m-k-1) continue; pq.push({y[cur.se][l[cur.se]--]+y[cur.se][r[cur.se]--],cur.se}); } for (int i = 0; i < n; ++i) { int cnt=0; for (int j = 0; j <= l[i]; ++j) { ans[i][j]=cnt++; } for (int j = r[i]+1; j < m; ++j) { ans[i][j]=cnt++; } } allocate_tickets(ans); return res; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:11:2: error: 'vectpr' was not declared in this scope
   11 |  vectpr<vector<long long>> y=x;
      |  ^~~~~~
tickets.cpp:11:25: error: expected primary-expression before '>' token
   11 |  vectpr<vector<long long>> y=x;
      |                         ^~
tickets.cpp:11:28: error: 'y' was not declared in this scope
   11 |  vectpr<vector<long long>> y=x;
      |                            ^
tickets.cpp:28:40: error: no matching function for call to 'std::priority_queue<std::pair<long long int, int> >::push(<brace-enclosed initializer list>)'
   28 |   pq.push({y[i][l[i]--]+y[i][r[i]--],i});
      |                                        ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int>, std::allocator<std::pair<long long int, int> > >; _Compare = std::less<std::pair<long long int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, int>]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, int>&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int>, std::allocator<std::pair<long long int, int> > >; _Compare = std::less<std::pair<long long int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, int>]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, int> >::value_type&&' {aka 'std::pair<long long int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
tickets.cpp:36:65: error: no matching function for call to 'std::priority_queue<std::pair<long long int, int> >::push(<brace-enclosed initializer list>)'
   36 |   pq.push({y[cur.se][l[cur.se]--]+y[cur.se][r[cur.se]--],cur.se});
      |                                                                 ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from tickets.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int>, std::allocator<std::pair<long long int, int> > >; _Compare = std::less<std::pair<long long int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, int>]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, int>&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int>, std::allocator<std::pair<long long int, int> > >; _Compare = std::less<std::pair<long long int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, int>]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, int> >::value_type&&' {aka 'std::pair<long long int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~