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;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
long long find_maximum(int k, std::vector<std::vector<int>> x)
{
int N = x.size();
int M = x[0].size();
ll value = 0;
vvi ans(N, vi(M, -1));
vpii choose;
for (int i = 0; i < N; ++i)
{
int mini = min_element(all(x[i])) - x[i].begin();
ans[i][mini] = 0;
mini = x[i][mini];
int maxi = *max_element(all(x[i]));
value -= mini;
choose.push_back({mini + maxi, i});
}
sort(all(choose));
for (int j = sz(choose) - 1; j >= sz(choose) / 2; --j)
{
int i = choose[j].second;
value += choose[j].first;
ans[i][min_element(all(x[i])) - x[i].begin()] = -1;
ans[i][max_element(all(x[i])) - x[i].begin()] = 0;
}
allocate_tickets(ans);
return value;
}
# | 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... |