Submission #421254

#TimeUsernameProblemLanguageResultExecution timeMemory
421254JUANDI321Carnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms204 KiB
#include "tickets.h" #include <vector> #include <algorithm> 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; 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); } vector<long long> l; long long sum = 0; for (int i = 0; i < n; i++) { l.push_back(x[i][m]); sum+=x[i][m]; for (int j = 0; j < m; j++) answer[i][j] = 0; } long long avg = sum/n, ans = 0; for(int i = 0; i<n; i++)ans += max(l[i]-avg, avg-l[i]); allocate_tickets(answer); return ans; }
#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...