Submission #464110

#TimeUsernameProblemLanguageResultExecution timeMemory
464110armandCarnival Tickets (IOI20_tickets)C++14
0 / 100
1 ms204 KiB
#include "tickets.h" #include <vector> #include <algorithm> using namespace std; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); int i, j, p; long long res = 0; int b; std::vector<std::vector<int>> answer; vector<int> a(n); for (i = 0; i < n; i++) { std::vector<int> row(m); for (j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } allocate_tickets(answer); for (j = n-1, p = 0; p<k && j>=0; j--,p++) { for (i = 0; i < n; i++) a[i] = x[i][j]; sort(a.begin(), a.end()); b = a[n / 2]; for (i = 0; i < n; i++) res += llabs(b - a[i]); } return res; }
#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...