| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1331180 | imorange | Stove (JOI18_stove) | C++20 | 44 ms | 1436 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k,ans=0;
cin >> n >> k;
vector<int> sea(n);
for(auto &q:sea) cin >> q;
priority_queue<int, vector<int>, greater<int>>pq;
for(int i =1; i < n; i++) pq.push(sea[i]-(sea[i-1]+1));
while(pq.size() > k-1 && !pq.empty()){
ans+=pq.top();
pq.pop();
}
cout << ans+n;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
