This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(), m = x[0].size();
vector<vector<int>> g(n, vector<int> (m, -1));
ll res {};
int l[n] {}, r[n];
fill(r, r + n, m-1);
for(int c = 0; c < k; ++c) {
array<ll, 2> a[n] {};
for(int i = n; i--; ) {
res -= x[i][l[i]];
a[i] = {x[i][l[i]] + x[i][r[i]], i};
}
sort(a, a + n);
for(int i = n/2; i < n; ++i)
g[a[i][1]][r[a[i][1]]--] = c, res += a[i][0];
for(int i = n/2; i--; )
g[a[i][1]][l[a[i][1]]++] = c;
}
allocate_tickets(g);
return res;
}
# | 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... |