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;
#define F first
#define S second
const int N = 1504;
vector <int> v[N];
int c[N];
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
std::vector<std::vector<int>> answer;
for (int i = 0; i < n; i++) {
std::vector<int> row(m);
answer.push_back(row);
}
long long ans = 0;
vector <pair <long long, int>> v;
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
ans += x[i][m - j - 1];
v.push_back(make_pair (x[i][m - j - 1] + x[i][k - j - 1], i));
}
}
sort (v.begin(), v.end());
for (int i = 0; i < (n / 2) * k; i++) {
ans -= v[i].F;
c[v[i].S]++;
}
long long wefwef = 0;
long long mxa = LLONG_MIN;
long long mna = LLONG_MAX;
for (int i = 0; i < n; i++ ){
for (int j = 0; j < m; j++) {
if (j < c[i]) {
wefwef -= x[i][j];
mxa = max (mxa, (long long)x[i][j]);
answer[i][j] = j;
} else if (j >= m - (k - c[i])) {
answer[i][j] = c[i] + j - (m - (k - c[i]));
mna = min (mna, (long long)x[i][j]);
wefwef += x[i][j];
} else
answer[i][j] = -1;
}
}
assert (mxa <= mna);
assert (wefwef == ans);
allocate_tickets(answer);
return 6;
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... |