# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
364478 |
2021-02-09T10:11:10 Z |
NachoLibre |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, k, a[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> k;
if(n == 1) return cout << 1 << endl, 0;
for(int i = 0; i < n; ++i) {
cin >> a[i];
if(i) a[i - 1] = a[i] - a[i - 1];
}
sort(a, a + n - 1);
long long fp = n;
for(int i = 0; i < n - k; ++i) {
fp += a[i];
}
cout << fp << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |