# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
304427 | urd05 | 카니발 티켓 (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;
static int n;
static int m;
static int k;
static std::vector<std::vector<int>> d;
static std::vector<std::vector<int>> x;
static int called = 0;
static void check(bool cond, std::string message) {
if (!cond) {
printf("%s\n", message.c_str());
exit(0);
}
}
void allocate_tickets( std::vector<std::vector<int>> _d) {
check(!called, "allocate_tickets called more than once");
d = _d;
check((int)d.size() == n, "allocate_tickets called with parameter of wrong size");
for (int i = 0; i < n; i++) {
check((int)d[i].size() == m, "allocate_tickets called with parameter of wrong size");
}
called = 1;
}
long long dp[81][6400];
const long long INF=1e16;
long long find_maximum(int k, vector<vector<int>> v) {
int n = v.size();
int m = v[0].size();
vector<vector<int>> answer(n,vector<int>(m));
vector<int> temp;
for(int i=0;i<n;i++) {
temp.push_back(v[i][0]);
answer[i][0]=0;
for(int j=1;j<m;j++) {
answer[i][j]=-1;
}
}
sort(temp.begin(),temp.end());
long long ret=0;
for(int i=0;i<n/2;i++) {
ret-=temp[i];
}
for(int i=n/2;i<n;i++) {
ret+=temp[i];
}
allocate_tickets(answer);
return ret;
}