이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "tickets.h"
using namespace std;
int n, m, kezd, db[1502], ki, ert;
long long sum;
vector<vector<pair<int, int> > > sz;
vector<vector<int>> sol;
vector<pair<int, int> > q;
long long find_maximum(int k, vector<vector<int> > x) {
n=x.size(), m=x[0].size();
sol.resize(n), sz.resize(n);
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) sol[i].push_back(-1), sz[i].push_back({x[i][j], j});
sort(sz[i].begin(), sz[i].end());
for (int j=0; j<k; j++) {
sum-=sz[i][j].first;
q.push_back({sz[i][m-k+j].first+sz[i][j].first, i});
}
}
sort(q.rbegin(), q.rend());
for (int i=0; i<n*k/2; i++) db[q[i].second]++, sum+=q[i].first;
for (int i=0; i<n; i++) {
for (int j=0; j<db[i]; j++) {
ki=sz[i][m-1-j].second, ert=(kezd+j)%k;
sol[i][ki]=ert;
}
kezd+=db[i];
for (int j=0; j<k-db[i]; j++) {
ki=sz[i][j].second, ert=(kezd+j)%k;
sol[i][ki]=ert;
}
}
allocate_tickets(sol);
return sum;
}
# | 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... |