| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1370031 | chargeelectrum | Stove (JOI18_stove) | C++17 | 11 ms | 1480 KiB |
#include<bits/stdc++.h>
#define endl '\n'
#define sp ' '
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int n,k;
cin >> n >> k;
vector<int> a(n),dis;
for(int i=0;i<n;i++) cin >> a[i];
for(int i=1;i<n;i++) dis.push_back(a[i]-a[i-1]-1);
sort(dis.begin(),dis.end());
int del=0;
while(--k){
del+=dis.back();
dis.pop_back();
}
cout << a.back()+1-a.front()-del;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
