| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357292 | Aviansh | Potatoes and fertilizers (LMIO19_bulves) | C++20 | 120 ms | 8792 KiB |
#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
long long d = 0;
long long val = 0;
priority_queue<long long>pq;
for(int i = 0;i<n;i++){
pq.push(0);
}
for(int i = 0;i<n;i++){
int a,b;
cin >> a >> b;
d+=a-b;
pq.push(d);
pq.push(d);
if(pq.top()>d){
val+=pq.top()-d;
}
pq.pop();
}
while(pq.size()&&pq.top()>d){
val+=pq.top()-d;
pq.pop();
}
cout << val;
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... | ||||
