# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
430703 |
2021-06-17T01:22:57 Z |
Pietra |
Stove (JOI18_stove) |
C++14 |
|
61 ms |
2108 KB |
#include<bits/stdc++.h>
#define int long long
using namespace std ;
const int maxn = 1e6 + 5 ;
int n, k, a, t[maxn], in[maxn] ;
int32_t main(){
cin >> n >> k ;
cin >> a ;
k-- ;
int timer = 1 ;
for(int i = 1, ta ; i < n ; i++){
cin >> ta ;
t[i] = ta - a - 1 ;
timer += t[i] + 1 ;
a = ta ;
}
sort(t + 1, t + 1 + n) ; reverse(t + 1, t + 1 + n) ;
for(int i = 1 ; i <= k ; i++) timer -= t[i] ;
cout << timer << "\n" ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
332 KB |
Output is correct |
15 |
Correct |
3 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
332 KB |
Output is correct |
15 |
Correct |
3 ms |
364 KB |
Output is correct |
16 |
Correct |
51 ms |
2036 KB |
Output is correct |
17 |
Correct |
52 ms |
2052 KB |
Output is correct |
18 |
Correct |
51 ms |
2048 KB |
Output is correct |
19 |
Correct |
57 ms |
2108 KB |
Output is correct |
20 |
Correct |
50 ms |
1952 KB |
Output is correct |
21 |
Correct |
56 ms |
2040 KB |
Output is correct |
22 |
Correct |
61 ms |
2004 KB |
Output is correct |
23 |
Correct |
57 ms |
1976 KB |
Output is correct |
24 |
Correct |
50 ms |
1976 KB |
Output is correct |