이 제출은 이전 버전의 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++){
val.push_back(x[i][0]);
val.push_back(x[i][M - 1]);
}
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++){
sum += max(abs(b - x[i][0]),abs(b - x[i][M - 1]));
}
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++){
if(abs(mini.second - x[i][0]) >= abs(mini.second - x[i][M - 1])){
ans[i][0] = 0;
}else{
ans[i][M - 1] = 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... |