# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582137 | AlexLuchianov | Arranging Tickets (JOI17_arranging_tickets) | C++14 | 803 ms | 13964 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 <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <queue>
using ll = long long;
int const nmax = 200000;
ll acc[5 + nmax];
ll init[5 + nmax], pref[5 + nmax], suff[5 + nmax];
std::vector<std::pair<int,int>> queries[5 + nmax];
bool solve(int n, int m, int start, ll smax, ll target) {
std::priority_queue<std::pair<int,int>> pq;
for(int i = 1;i <= n; i++)
acc[i] = 0;
ll expended = 0;
for(int i = 1;i <= start; i++) {
ll needToErase = (1 + init[i] + target - smax) / 2;
needToErase = std::max(0LL, needToErase - expended);
for(int h = 0; h < queries[i].size(); h++)
pq.push(queries[i][h]);
expended += needToErase;
while(0 < pq.size() && 0 < needToErase) {
std::pair<int,int> tp = pq.top();
# | 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... |