Submission #421270

#TimeUsernameProblemLanguageResultExecution timeMemory
421270MonchitoCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms588 KiB
#include "tickets.h" #include <vector> #include <iostream> #include <algorithm> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; int n, m, K; vector<vi> answer; ll find_maximum(int k, vvi x){ n = x.size(); m = x[0].size(); answer = vvi(n, vi(m, -1)); int a[n]; for(int i=0; i<n; i++) a[i] = x[i][0]; sort(a, a+n); ll mid_floor = a[n/2]; ll mid_ceil = a[n/2 - 1]; ll s1, s2; s1 = s2 = 0; for(int i=0; i<n; i++) s1 += abs((ll)x[i][0] - mid_floor); for(int i=0; i<n; i++) s2 += abs((ll)x[i][0] - mid_ceil); for(int i=0; i<n; i++) answer[i][0] = 0; allocate_tickets(answer); return min(s1, s2); }
#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...