Submission #1062928

#TimeUsernameProblemLanguageResultExecution timeMemory
1062928KiprasCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; #include "tickets.h" constexpr ll maxN = 1510; vector<pair<ll, ll>> colours[maxN]; vector<vector<ll>> ans; long long find_maximum(int k, vector<vector<int>> a) { ll coloursN = a.size(); ll n = a[0].size(); ll res=0; for(int i = 0; i < coloursN; i++) { vector<ll> tmp; for(int x = 0; x < n; x++) { colours[i].push_back({a[i][x], x}); tmp.push_back({-1}); } ans.push_back(tmp); } for(int i = 0; i < coloursN; i++) sort(colours[i].begin(), colours[i].end()); priority_queue<pair<ll, pair<ll, pair<ll, ll>>>> q; for(int i = 0; i < coloursN; i++) { for(int x = 0; x < k; x++) { res+=colours[i][x].first; ans[i][colours[i][x].second]=x; q.push({-colours[i][x].first-colours[i][n-k+x].first, {i, {x, n-k+x}}}); } } for(int i = 0; i < k*(coloursN/2); i++) { pair<ll, pair<ll, pair<ll, ll>>> tmpPair = q.top(); q.pop(); res-= tmpPair.first; ll color = tmpPair.second.first; ll u = tmpPair.second.second.first; ll v = tmpPair.second.second.second; ans[color][v]=ans[color][u]; if(u!=v)ans[color][u]=-1; } 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:51:22: error: could not convert 'ans' from 'vector<vector<long long int>>' to 'vector<vector<int>>'
   51 |     allocate_tickets(ans);
      |                      ^~~
      |                      |
      |                      vector<vector<long long int>>