# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
127327 |
2019-07-09T08:32:51 Z |
lamkhanh |
Stove (JOI18_stove) |
C++17 |
|
83 ms |
2224 KB |
#include<bits/stdc++.h>
using namespace std;
int n, k, i, timego[100002], kc[100002];
int main(){
cin >> n >> k;
if(n==k){
cout << n;
return 0;
}
else{
for(i=1;i<=n;i++)
cin >> timego[i];
for(i=1;i<n;i++)
kc[i] = timego[i+1] - timego[i] - 1;
sort(kc+1, kc+n);
int ans = n;
for(i=1;i<n-k+1;i++)
ans += kc[i];
cout << ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
4 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
4 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
4 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
4 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
4 ms |
376 KB |
Output is correct |
16 |
Correct |
83 ms |
2224 KB |
Output is correct |
17 |
Correct |
83 ms |
1996 KB |
Output is correct |
18 |
Correct |
83 ms |
1844 KB |
Output is correct |
19 |
Correct |
82 ms |
2040 KB |
Output is correct |
20 |
Correct |
83 ms |
2040 KB |
Output is correct |
21 |
Correct |
83 ms |
1912 KB |
Output is correct |
22 |
Correct |
83 ms |
2120 KB |
Output is correct |
23 |
Correct |
82 ms |
1884 KB |
Output is correct |
24 |
Correct |
83 ms |
1928 KB |
Output is correct |