Submission #303217

#TimeUsernameProblemLanguageResultExecution timeMemory
303217limabeansCarnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms512 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; template<typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl using ll = long long; const int maxn = 1e6 + 5; ll eval(vector<ll> v, ll x) { ll S = 0; for (ll a: v) { S += abs(a-x); } return S; } long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); assert(m==1); vector<ll> v; vector<vector<int>> ans(n, vector<int>(k)); for (int i=0; i<n; i++) { for (int j=0; j<k; j++) { ans[i][j] = 0; v.push_back(ans[i][j]); } } sort(v.begin(), v.end()); allocate_tickets(ans); return eval(v, v[(int)v.size() / 2]); }
#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...