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 <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#include "tickets.h"
#include <vector>
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(n,vector<int> (m, -1));
vector<int> seq[n];
vector<int> A;
int64_t ret = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
seq[i].push_back(j);
}
sort(all(seq[i]), [&](int a, int b){
return x[i][a] < x[i][b];
});
A.push_back(i);
ret += x[i][seq[i].back()];
}
sort(all(A), [&](int a, int b){
return x[a][seq[a][0]] + x[a][seq[b][m - 1]] < x[b][seq[b][0]] + x[b][seq[b][m - 1]];
});
for(int i = 0; i < n/2; i++){
ret -= x[A[i]][seq[A[i]][0]];
ret -= x[A[i]][seq[A[i]][m - 1]];
answer[A[i]][seq[A[i]][0]] = 0;
}
for(int i = n / 2; i < n; i++){
answer[A[i]][seq[A[i]][m - 1]] = 0;
}
allocate_tickets(answer);
return ret;
}
# | 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... |