Submission #868916

# Submission time Handle Problem Language Result Execution time Memory
868916 2023-11-02T12:27:58 Z F_Universe Stove (JOI18_stove) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,k;
  cin >>n >>k;
  int x[n];
  int y[n];
  int sum=0;
  y[0]=0;
  for(int i=0;i<n;i++){
    cin >>x[i];
  }
  for(int i=1;i<n;i++){
    y[i]=x[i]-x[i-1];
    
  }
  sort(y,y+n);
  for(int i=0;i<n-k;i++){
    sum+=y[i]+1;
  }
  printf("%d",sum);

  
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -