이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long find_maximum(int k, std::vector<std::vector<int>> d) {
int N=d.size();
int M=d[0].size();
vector<int> ord;
for(int i=0;i<N;i++) ord.push_back(i);
sort(ord.begin(),ord.end(),[&](int i, int j) {
return d[i]<d[j];
});
vector<vector<int>> s(N,vector<int>(M,-1));
vector<pair<int,int>> vals;
for(int j=0;j<M;j++) {
int s=0;
for(int i=0;i<N/2;i++) s+=d[ord[i]][j];
for(int i=N/2;i<N;i++) s+=d[ord[i]][M-j-1];
s=min(s,N-s);
vals.push_back({s,j});
}
sort(vals.rbegin(),vals.rend());
ll ans=0;
for(int j=0;j<k;j++) {
ans+=vals[j].first;
for(int i=0;i<N/2;i++) s[ord[i]][vals[j].second]=j;
for(int i=N/2;i<N;i++) s[ord[i]][M-vals[j].second-1]=j;
}
allocate_tickets(s);
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... |