Submission #412060

#TimeUsernameProblemLanguageResultExecution timeMemory
412060SuhaibSawalha1Carnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms692 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long calc (vector<long long> &a) { int n = a.size(); long long sum = accumulate(a.begin(), a.end(), 0LL), m = LLONG_MAX, sum2 = 0; sort(a.begin(), a.end()); for (int i = 0; i < n; ++i) { sum -= a[i]; m = min(m, a[i] * i - sum2 + sum - a[i] * (n - i - 1)); sum2 += a[i]; } return m; } long long find_maximum(int k, vector<vector<int>> a) { int n = a.size(); int m = a[0].size(); vector<vector<int>> g(n, vector<int>(m, 0)); vector<long long> ask; for (auto &e : a) { ask.push_back(e[0]); } allocate_tickets(g); return calc(ask); }
#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...