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>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int) (x).size())
using namespace std;
void allocate_tickets(vector<vector<int>> _d);
int N, M;
long long find_maximum(int k, vector<vector<int>> x){
N = SZ(x), M = SZ(x[0]);
vector<vector<int>> alloc = x;
ll ans = 0;
if(M == 1){
vector<int> v = x[0];
sort(v.begin(), v.end());
int median1 = v[(N-1)/2], median2 = v[N/2];
ll ans1 = 0, ans2 = 0;
for(int i = 0; i < N; i++){
ans1 += abs(median1 - v[i]);
ans2 += abs(median2 - v[i]);
}
for(int i = 0; i < N; i++){
alloc[0][i] = 0;
}
ans = max(ans1, ans2);
}
allocate_tickets(alloc);
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... |