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>
#include "tickets.h"
using namespace std;
using ll = long long;
#define MAXN (1000005)
long long find_maximum(int k, vector<vector<int>> x) {
ll N = x.size();
ll M = x[0].size();
vector<ll> all;
for(ll i = 0;i < N;i++){
for(ll j = 0;j < M;j++){
all.push_back(x[i][j]);
}
}
sort(all.begin(),all.end());
pair<ll,ll> best = {-1,-1};
for(auto b : all){
ll sum = 0;
for(ll i = 0;i < N;i++){
sum += abs(b - x[i][0]);
}
best = max(best,{sum,b});
}
vector<vector<int> > ans;
for(ll i = 0;i < N;i++){
vector<int> row;
row.push_back(0);
ans.push_back(row);
}
allocate_tickets(ans);
return best.first;
}
# | 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... |