이 제출은 이전 버전의 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<tuple<int, int, int>> v;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
v.emplace_back(x[i][j], i, j);
}
}
sort(v.begin(), v.end());
vector f(N, vector<int>(M, -1));
ll ans = 0;
for (int i = 0; i < N * K / 2; i++) {
auto [t, x, y] = v[i];
ans -= t;
f[x][y] = 0;
}
for (int i = N * M - N * K / 2; i < N * M; i++) {
auto [t, x, y] = v[i];
ans += t;
f[x][y] = 1;
}
vector a(N, vector<int>(M));
int s = 0, t = K - 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (f[i][j] == 0) {
a[i][j] = t--;
}
if (f[i][j] == 1) {
a[i][j] = s++;
}
if (t == -1) {
t = K - 1;
}
if (s == K) {
s = 0;
}
}
}
allocate_tickets(a);
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... |