# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305382 | JooDdae | Carnival Tickets (IOI20_tickets) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "tickets.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<int> v;
for(int i=0;i<n;i++) v.push_back(x[i][0]);
sort(v.begin(), v.end());
allocate_tickets(v);
ll ans = 0;
for(int i=0;i<n/2;i++) ans -= v[i];
for(int i=n/2;i<n;i++) ans += v[i];
return ans;
}