# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
253216 | Berted | Potatoes and fertilizers (LMIO19_bulves) | C++14 | 198 ms | 8632 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 <queue>
#define ll long long
using namespace std;
/*
Transform the array into A - B
We could change an operation into -1 +1 adjacent indices
Transform the array into prefix sum
Now, an operation changed A[i] into A[i] + 1 or A[i] - 1
for 1 <= i < N. A[0] = 0, A[N] = SUM;
Therefore the array must be transformed such that it is non-decreasing
We can achieve this with slope trick.
*/
const ll INF = 1e18;
int n;
ll ar[500001], res = 0;
priority_queue<ll> pq;
int main()
{
ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
{
int a, b; cin >> a >> b;
# | 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... |