# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
818702 |
2023-08-10T06:24:11 Z |
vjudge1 |
Stove (JOI18_stove) |
C++17 |
|
0 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N, K;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> N >> K;
vector<int> t(N);
for(int i = 0; i < N; i++) cin >> t[i];
int ans = t.back();
vector<int> v;
for(int i = 1; i < N; i++) {
v.push_back(t[i] - t[i - 1] - 1);
}
sort(v.begin(), v.end());
while(!v.empty() && K > 1) {
ans -= v.back();
K--;
v.pop_back();
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |