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>
#include "tickets.h"
#define ll long long
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;
bool tt[100001];
long long find_maximum(int k, std::vector<std::vector<int>> a) {
int n = a.size();
int m = a[0].size();
std::vector<std::vector<int>> answer;
answer.resize(n);
for (int i = 0; i < n; i++)
answer[i].resize(m, -1);
vector<pll> v;
for (int i = 0; i < n; i++)
v.pb(mp(0, m-1));
ll ans=0;
for (int it = 0; it < k; it++)
{
ll sm=0;
vector<pll> z;
for (int i = 0; i < n; i++) tt[i]=0;
for (int i = 0; i < n; i++)
{
sm-=a[i][v[i].fi];
z.pb(mp(a[i][v[i].se]+a[i][v[i].fi], i));
}
sort(all(z));
for (int i = n/2; i < n; i++)
{
tt[z[i].se]=1;
sm+=z[i].fi;
}
ans+=sm;
for (int i = 0; i < n; i++)
if (tt[i])
{
answer[i][v[i].se]=it;
v[i].se--;
}else
{
answer[i][v[i].fi]=it;
v[i].fi++;
}
}
allocate_tickets(answer);
return ans;
}
# | 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... |