이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for (int i = s; i <= e; ++i)
typedef long long ll;
typedef vector<int> vi;
long long find_maximum(int k, vector<vi> x) {
ll n = x.size(), m = x[0].size(), cur = 0, cnt[n] = {}, id = 0;
vector<vi> ans(n, vi(m, -1));
priority_queue<pair<ll,ll>> pq;
rep (i,0,n-1) {
rep (j,0,k-1) cur -= x[i][j];
pq.push({x[i][k-1]+x[i][m-1], i});
}
rep (run,1,n*k/2) {
ll val = pq.top().first, u = pq.top().second;
pq.pop();
cur += val;
if (++cnt[u]<k) pq.push({x[u][k-1-cnt[u]]+x[u][m-1-cnt[u]], u});
}
rep (i,0,n-1) {
rep (j,0,k-1) ans[i][(m-cnt[i]+j)%m] = (id+j)%k;
id += cnt[i];
}
allocate_tickets(ans);
return cur;
}
# | 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... |