이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
ll find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
ll val = 1e18;
std::vector<std::vector<int>> answer;
vector<int> temp;
for (int i = 0; i < n; i++) {
std::vector<int> row(m,-1);
row[0] = 0;
temp.push_back(x[i][0]);
answer.push_back(row);
}
sort(temp.begin(),temp.end());
int mid = (n/2)-1;
ll midV = temp[mid] + temp[mid+1];
for(int j=0;j<2;j++){
ll cur = 0;
for (int i = 0; i < n; i++) cur += abs((midV+j) - temp[i]);
val = min(val,cur);
}
allocate_tickets(answer);
return val;
}
# | 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... |