# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
430698 |
2021-06-17T01:15:46 Z |
Pietra |
Stove (JOI18_stove) |
C++14 |
|
1 ms |
204 KB |
#include<bits/stdc++.h>
#define int long long
using namespace std ;
const int maxn = 1e5 + 5 ;
int n, k, t[maxn], in[maxn] ;
int32_t main(){
cin >> n >> k ;
for(int i = 1 ; i <= n ; i++) cin >> t[i] ;
for(int i = 2 ; i <= n ; i++) in[i-1] = abs(t[i] - 1 - t[i-1]) ;
int timer = 1 ;
sort(in + 1, in + 1 + n) ; reverse(in + 1, in + 1 + n) ;
for(int i = k ; i <= n ; i++) timer += (in[i] + 1) ;
cout << timer << "\n" ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |