Submission #480120

#TimeUsernameProblemLanguageResultExecution timeMemory
480120couplefireCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; #define int long long int find_maximum(int k, vector<vector<int>> x){ int n = x.size(), m = x[0].size(); vector<int> stuff(n, k-1); set<array<int, 2>, greater<>> se; int ans = 0; for(int i = 0; i<n; ++i) se.insert({x[i][m-1]+x[i][k-1], i}); for(int i = 0; i<n; ++i) for(int j = 0; j<k; ++j) ans -= x[i][j]; for(int _ = 0; _<n*k/2; ++_){ auto [a, b] = *se.begin(); se.erase(se.begin()); ans += a; stuff[b]--; if(stuff[b]>=0) se.insert({x[b][stuff[b]]+x[b][stuff[b]+m-k], b}); } vector<vector<int>> res(n, vector<int>(m, -1)); vector<array<int, 2>> bd(n); for(int i = 0; i<n; ++i) bd[i] = {stuff[i], stuff[i]+m-k+1}; for(int i = 0; i<k; ++i){ vector<int> arr(n); iota(arr.begin(), arr.end(), 0); sort(arr.begin(), arr.end(), [&](int a, int b){return bd[a]>bd[b];}); for(int j = 0; j<n/2; ++j) res[arr[j]][bd[arr[j]][0]] = i, --bd[arr[j]][0]; for(int j = n/2; j<n; ++j) res[arr[j]][bd[arr[j]][1]] = i, ++bd[arr[j]][1]; } allocate_tickets(res); return ans; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(long long int, std::vector<std::vector<long long int> >)':
tickets.cpp:33:22: error: could not convert 'res' from 'vector<vector<long long int>>' to 'vector<vector<int>>'
   33 |     allocate_tickets(res); return ans;
      |                      ^~~
      |                      |
      |                      vector<vector<long long int>>