# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592407 | ogibogi2004 | Carnival Tickets (IOI20_tickets) | C++14 | 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 <vector>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
long long find_maximum(ll k, vector<vector<ll>> x) {
//cout<<"?\n";
ll n = x.size();
ll m = x[0].size();
vector<vector<int>> answer;
vector<ll>smallest[n];
for(ll i=0;i<n;i++)
{
smallest[i]=x[i];
sort(smallest[i].begin(),smallest[i].end());
}
ll use[n][m];
memset(use,-1,sizeof(use));
ll dp[n][n*k];
ll hist[n][n*k];
bool c[n][n*k];
memset(c,0,sizeof(c));
ll sum=0;
for(ll j=0;j<k;j++)sum-=smallest[0][j];
dp[0][k]=sum;c[0][k]=1;
hist[0][k]=k;
for(ll j=k-1;j>=0;j--)
{
sum+=smallest[0][j];
sum+=smallest[0][smallest[0].size()-(k-j)];