이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |