이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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> val;
for(ll i = 0;i < N;i++){
for(ll j = 0;j < M;j++){
val.push_back(x[i][j]);
}
}
sort(val.begin(),val.end());
pair<ll,ll> mini = {1e18,-1};
for(auto b : val){
ll sum = 0;
for(ll i = 0;i < N;i++){
ll maximum = -1e18;
for(ll j = 0;j < M;j++){
maximum = max(maximum,abs(b - x[i][j]));
}
sum += maximum;
}
mini = min(mini,{sum,b});
}
vector<vector<int> > ans;
for(ll i = 0;i < N;i++){
vector<int> row;
for(ll j = 0;j < M;j++){
row.push_back(-1);
}
ans.push_back(row);
}
for(ll i = 0;i < N;i++){
ll maximum = -1e18;
ll ind = -1;
for(ll j = 0;j < M;j++){
if(maximum <= abs(mini.second - x[i][j])){
maximum = abs(mini.second - x[i][j]);
ind = j;
}
}
ans[i][ind] = 0;
}
allocate_tickets(ans);
return mini.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... |