이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using pLL = array <LL, 2>;
using tLL = array <LL, 3>;
LL find_maximum(int k, vector<vector<int>> x) {
LL ans = 0;
int n = x.size(), m = x[0].size();
vector <pLL> A;
vector<vector<int>> s;
s.resize(n, vector <int> (m, -1));
priority_queue <tLL> pq;
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
ans -= x[i][j];
s[i][j] = j;
}
}
for (int i = 0; i < n; i++) pq.push({x[i][k - 1] + x[i][m - 1], i, k - 1});
for (int i = 0; i < n * k / 2; i++){
tLL now = pq.top(); pq.pop();
ans += now[0];
s[now[1]][now[2]] = -1;
s[now[1]][now[2] + m - k] = now[2];
if (now[2]) pq.push({x[now[1]][now[2] - 1] + x[now[1]][now[2] + m - k - 1], now[1], now[2] - 1});
}
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... |