# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
397725 | leinad2 | 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<bits/stdc++.h>
using namespace std;
long long find_maximum(int k, vector<vector<int> > x)
{
int n=x.size();int m=x[0].size();int i, j;
vector<int>v;
for(i=0;i<n;i++)
{
v.push_back(x[i][0]);
}
sort(v.begin(), v.end());
long long ans=0;
for(i=0;i<v.size();i++)
{
if(2*i<v.size())ans-=v[i];
else ans+=v[i];
}
vector<vector<int> >res;
res.resize(n);
for(i=0;i<n;i++)
{
res[i].resize(m);
for(j=0;j<m;j++)res[i][j]=-1;
}
for(i=0;i<n;i++)res[i][0]=0;
allocate_tickets(res);
return ans;
}