이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define readl(_s) getline(cin, (_s));
#define boost() cin.tie(0); cin.sync_with_stdio(0)
const int MN = 1505;
int n, m, tot;
vector<int> rnd(1505);
void allocate_tickets(vector<vector<int32_t>> s);
ll find_maximum(int32_t k, vector<vector<int32_t>> a) {
n = a.size(), m = a[0].size();
for (int i = 0; i < n; i++) {
for (int j = m - k; j < m; j++) { //half max, half min, choose all max first then trade for loss.
tot += a[i][j];
}
}
vector<pii> v;
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
v.push_back({-a[i][j] - a[i][m - k + j], i}); //we will take the min from this row since it loses the least pts.
}
}
vector<vector<int32_t>> ans(n, vector<int32_t> (m, -1));
sort(v.begin(), v.end(), greater<>());
for (int i = 0; i < n * k / 2; i++) tot += v[i].f, rnd[v[i].s]++;
int id = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < rnd[i]; j++) {
ans[i][j] = id;
id++, id %= k;
}
int id1 = id;
for (int j = m - 1; j > m - 1 - (k - rnd[i]); j--) {
ans[i][j] = id1;
id1++, id1 %= k;
}
}
allocate_tickets(ans);
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... |