Submission #832328

#TimeUsernameProblemLanguageResultExecution timeMemory
832328JohannCarnival Tickets (IOI20_tickets)C++14
27 / 100
432 ms53396 KiB
#include "tickets.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vpii; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() long long find_maximum(int k, std::vector<std::vector<int>> x) { int N = x.size(); int M = x[0].size(); ll value = 0; vvi ans(N, vi(M, -1)); vpii choose; for (int i = 0; i < N; ++i) { int mini = min_element(all(x[i])) - x[i].begin(); ans[i][mini] = 0; mini = x[i][mini]; int maxi = *max_element(all(x[i])); value -= mini; choose.push_back({mini + maxi, i}); } sort(all(choose)); for (int j = sz(choose) - 1; j >= sz(choose) / 2; --j) { int i = choose[j].second; value += choose[j].first; ans[i][min_element(all(x[i])) - x[i].begin()] = -1; ans[i][max_element(all(x[i])) - x[i].begin()] = 0; } allocate_tickets(ans); return value; }
#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...