# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
421242 | Monchito | Carnival Tickets (IOI20_tickets) | C++14 | 1 ms | 204 KiB |
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 "tickets.h"
#include <vector>
#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
const ll INF = 1e18;
int n, m, K;
vector<vi> answer;
deque<pair<int,ll>> hi, lo;
ll find_maximum(int k, vvi x){
n = x.size();
m = x[0].size();
answer = vvi(n, vi(m, -1));
ll S = 0, max_value = -INF, min_value = INF;
for(int i=0; i<n; i++){
answer[i][0] = 0;
max_value = max((ll)x[i][0], max_value);
min_value = min((ll)x[i][0], min_value);
}
ll mid_floor = (max_value + min_value) / 2;
ll mid_ceil = (max_value + min_value + 1) / 2;
ll s1, s2; s1 = s2 = 0;
for(int i=0; i<n; i++) s1 += abs(x[i][0] - mid_floor);
for(int i=0; i<n; i++) s2 += abs(x[i][0] - mid_ceil);
allocate_tickets(answer);
return min(s1, s2);
}
Compilation message (stderr)
# | 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... |