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>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
ll find_maximum(int k,vector<vi> x)
{
int n=sz(x);
int m=sz(x[0]);
ll sum=0;
vpi v;
for (int i=0;i<n;i++)sum+=x[i][m-1];
for (int i=0;i<n;i++)v.pb({-x[i][0]-x[i][m-1],i});
sort(v.begin(),v.end());
int g=n/2;
int prog[20000]={0};
while(g--)
{
sum+=v[sz(v)-1].f;
prog[v[sz(v)-1].s]++;
v.pop_back();
}
for (int i=0;i<n;i++)
{
fill(x[i].begin(),x[i].end(),-1);
if (prog[i]==0)x[i][m-1]=0;
else x[i][0]=0;
}
allocate_tickets(x);
return sum;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |