Submission #429494

#TimeUsernameProblemLanguageResultExecution timeMemory
429494MrFranchoCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms716 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<vector<int>> answer(n); if(m == 1) { vector<int> p; for (int i = 0; i < n; i++) { answer[i].push_back(0); p.push_back(x[i][0]); } sort(p.begin(), p.end()); int median = floor((p[n/2]+p[n/2-1])/2); long long val = 0; for (int i = 0; i < n; i++) { val += 1LL*abs(median-p[i]); } allocate_tickets(answer); return val; } else { for (int i = 0; i < n; i++) { vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } allocate_tickets(answer); return 1; } }
#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...