# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1142854 | PagodePaiva | Carnival Tickets (IOI20_tickets) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#include "tickets.h"
#include <vector>
using namespace std;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
std::vector<std::vector<int>> answer;
vector <int> v;
for(int i = 0;i < n;i++){
answer.push_back({0});
v.push_back(x[i][0]);
}
sort(v.begin(), v.end());
alocate_tickets(answer);
int pos = n/2;
long long res = 0;
for(auto x : v){
res += abs(v[pos]-x);
}
return res;
}