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