이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long A[1505], B[1505];
priority_queue< pair<long long,long long> > pq;
pair<long long,long long> lst[1505];
long long find_maximum(int k, vector<vector<int>> x) {
long long N = x.size(), M = x[0].size(), val = 0;
for (long long i = 0; i < N; ++i) {
A[i] = k-1;
pq.emplace(x[i][k-1]+x[i][M-1],i);
for (long long j = 0; j < k; ++j) val -= x[i][j];
}
for (long long i = 0; i < k*N/2; ++i) {
val += pq.top().first;
long long n = pq.top().second; pq.pop();
A[n]--;
if (A[n] != -1) pq.emplace(x[n][A[n]]+x[n][A[n]+M-k],n);
}
for (long long i = 0; i < N; ++i) B[i] = A[i]+M-k+1, lst[i] = make_pair(M-B[i],i);
vector< vector<int> > ans (N, vector<int>(M,-1));
for (long long i = 0; i < k; ++i) {
sort(lst,lst+N);
for (long long j = 0; j < N/2; ++j) {
long long n = lst[j].second;
ans[n][A[n]] = i, A[n]--;
}
for (long long j = N/2; j < N; ++j) {
long long n = lst[j].second;
ans[n][B[n]] = i, B[n]++, lst[j].first--;
}
}
allocate_tickets(ans);
return val;
}
# | 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... |