이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <vector>
#include <algorithm>
#define pii pair<int,int>
using namespace std;
int n, m, K, cc, L[1600], R[1600];
int PL[1600], PR[1600];
pii CL[1600];
vector<pii>V;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
vector<vector<int>>res = x;
n = x.size();
m = x[0].size();
K = k;
int i, j;
for(i=0;i<n;i++)for(j=0;j<m;j++)res[i][j]=-1;
for(i=0;i<n;i++){
for(j=0;j<K;j++){
int b = x[i][j];
int e = x[i][m-K+j];
V.push_back({(e+b+1)/2,i});
}
}
sort(V.begin(),V.end());
for(i=0;i<n*K/2;i++){
L[V[i].second]++;
}
for(i=0;i<n;i++){
R[i]=K-L[i];
PL[i]=0,PR[i]=m-1;
}
long long ss=0;
for(i=0;i<K;i++){
for(j=0;j<n;j++){
CL[j]={L[j],j};
}
sort(CL,CL+n);
for(j=0;j<n;j++){
int t = CL[j].second;
if(j<n/2){
R[t]--;
ss+=x[t][PR[t]];
res[t][PR[t]--] = i;
}
else{
L[t]--;
ss-=x[t][PL[t]];
res[t][PL[t]++] = i;
}
}
}
allocate_tickets(res);
return ss;
}
# | 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... |