# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
545425 |
2022-04-04T13:33:28 Z |
LunaMeme |
Stove (JOI18_stove) |
C++14 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef vector<int> vi;
typedef long long ll;
#define PB push_back
#define MP make_pair
#define FOR(i, x, y) for (int i = x; i < y ; i ++)
int main(){
int n, k; cin >> n >> k;
int prev;
vi gaps;
cin >> prev;
FOR(i, 0, n - 1){
int num; cin >> num;
gaps.PB(num - prev - 1);
prev = num;
}
sort(gaps.begin(), gaps.end());
ll ans = n;
FOR(i, 0, k - 1){
ans += gaps[i];
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |