Submission #875680

#TimeUsernameProblemLanguageResultExecution timeMemory
875680abczzCarnival Tickets (IOI20_tickets)C++14
0 / 100
1 ms504 KiB
#include "tickets.h" #include <iostream> #include <vector> #include <array> #include <queue> #include <algorithm> #define ll long long using namespace std; long long find_maximum(int k, std::vector<std::vector<int>> x) { priority_queue<array<ll, 3>> pq; ll n = x.size(), m = x[0].size(), f = 0, s = 0, id[1500]; for (int i=0; i<n; ++i) { for (int j=0; j<k; ++j) { f -= x[i][j]; } pq.push({x[i][k-1]+x[i][m-1], i, k-1}); } for (int t=0; t<n*k/2; ++t) { auto [w, u, v] = pq.top(); pq.pop(); f += w; if (v) { --v; pq.push({x[u][v]+x[u][m-1-(k-1-v)], u, v-1}); } } return f; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:21:8: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |   auto [w, u, v] = pq.top();
      |        ^
tickets.cpp:13:43: warning: unused variable 's' [-Wunused-variable]
   13 |  ll n = x.size(), m = x[0].size(), f = 0, s = 0, id[1500];
      |                                           ^
tickets.cpp:13:50: warning: unused variable 'id' [-Wunused-variable]
   13 |  ll n = x.size(), m = x[0].size(), f = 0, s = 0, id[1500];
      |                                                  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...