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;
long long find_maximum(int k, std::vector<std::vector<int>> x)
{
int n = x.size(), m = x[0].size();
vector<pair<long long, int> > improve;
vector<vector<int> > ans(n, vector<int>(m, -1));
long long si = 0;
for (int i = 0; i < n; i++)
{
si -= x[i][0];
improve.push_back({x[i][0] + x[i][m - 1], i});
}
sort(improve.begin(), improve.end());
reverse(improve.begin(), improve.end());
for (int i = 0; i < n / 2; i++)
{
ans[improve[i].second][m - 1] = 0;
si += improve[i].first;
}
for (int i = n / 2; i < n; i++)
{
ans[improve[i].second][0] = 0;
}
allocate_tickets(ans);
return si;
}
# | 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... |