| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363679 | po_rag526 | Potatoes and fertilizers (LMIO19_bulves) | C++20 | 0 ms | 344 KiB |
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
priority_queue<int> pq;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
int sum = 0, ans = 0;
pq.push(0);
for (int i = 1; i <= n; i ++) {
int x, y;
cin >> x >> y;
sum += x - y;
pq.push(sum);
pq.push(sum);
ans += pq.top() - sum;
pq.pop();
}
cout << ans;
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
