이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |