| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1351830 | kismis | Stove (JOI18_stove) | C++20 | 24 ms | 1960 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vt vector
#define pb push_back
#define pob pop_back
#define endl '\n'
#define fi first
#define se second
signed main() {
int n , k;
cin >> n >> k;
vt<int>a(n);
for(int& i : a)
cin >> i;
int ans = n;
vt<int> b(n-1);
for(int i=0 ; i<n-1 ; i++)
b[i] = (a[i+1]-a[i])-1;
sort(b.begin() , b.end());
for(int i=0 ; i<n-k ; i++)
ans += b[i];
cout << ans << endl;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
