이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll find_maximum(int k, vector<vector<int>> x) {
int n = x.size();
int m = x[0].size();
vector<vector<int>> answer;
int N = n*m;
vector<array<int, 2>> v;
for(int i=0;i<n;i++) for(int j=0;j<m;j++) {
v.push_back({x[i][j], i});
}
sort(v.begin(), v.end());
ll ans = 0;
vector<int> c(n, 0), L(n, 0);
for(int i=0;i<N/2;i++) c[v[i][1]]++, ans += v[i+N/2][0] - v[i][0];
vector<int> R = c;
priority_queue<array<int, 2>> pq;
for(int i=0;i<n;i++) pq.push({c[i], i});
vector<vector<int>> re(n, vector<int>(m, -1));
for(int i=0;i<m;i++) {
set<int> s;
for(int j=0;j<n/2;j++) s.insert(pq.top()[1]), pq.pop();
for(int j=0;j<n;j++) {
if(s.count(j)) re[j][L[j]++] = i;
else re[j][R[j]++] = i;
}
for(auto x : s) pq.push({--c[x], x});
}
allocate_tickets(re);
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... |