# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1033931 |
2024-07-25T07:52:35 Z |
vjudge1 |
Stove (JOI18_stove) |
C++17 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 1e5 + 5;
ll n,k,res;
ll a[MAXN],pre[MAXN];
void solve(){
for(int i = 2;i<=n;i++){
pre[i] = a[i] - a[i-1];
}
sort(a+2,a+n+1);
for(int i = 1;i<=n - k;i++){
res += pre[i];
}
res += k;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>k;
for(int i = 1;i<=n;i++) cin>>a[i];
solve();
cout<<res;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |