이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include "tickets.h"
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int n, m, kk;
vector<vector<int> > a;
int beg[1501], endi[1501];
vector<pii> subt;
ll ansval=0;
vector<int> plamt;
vector<vector<int> > ans;
ll find_maximum(int kkk, vector<vector<int> > x)
{
int i, j;
n=x.size(), m=x[1].size(), kk=kkk;
a=x;
for(i=0;i<m;i++)
plamt.pb(0);
for(i=0;i<n;i++)
ans.pb(plamt);
for(i=0;i<n;i++)
sort(a[i].begin(), a[i].end());
for(i=0;i<n;i++)
endi[i]=m-1;
for(i=0;i<kk;i++){
subt.clear();
for(j=0;j<n;j++){
ansval+=a[j][endi[j]];
subt.pb({a[j][endi[j]]+a[j][beg[j]], j});
}
sort(subt.begin(), subt.end());
for(j=0;j<n/2;j++){
ansval-=subt[j].first;
ans[j][beg[j]]=i;
beg[subt[j].second]++;
}
for(j=n/2;j<n;j++){
ans[j][endi[j]]=i;
endi[subt[j].second]--;
}
}
allocate_tickets(ans);
return ansval;
}
# | 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... |