Submission #423753

# Submission time Handle Problem Language Result Execution time Memory
423753 2021-06-11T12:20:58 Z Apiram Stove (JOI18_stove) C++14
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int64_t n,k;cin>>n>>k;
    vector<int64_t>arr(n);
    for (int i =0;i<n;++i){
        cin>>arr[i];
    }
  vector<int64_t>brr;
  for (int i =1;i<n;++i){
    brr.push_back(arr[i]-arr[i-1]-1);
  }
  sort(brr.rbegin(),brr.rend());
  int64_t ans = arr[n-1]+1-arr[0];
  for (int i =0;i<k;++i)ans-=brr[i];
  cout<<ans<<endl;}
//2 + 4 + 3 + 2 + 1
# 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 -