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