Submission #647974

# Submission time Handle Problem Language Result Execution time Memory
647974 2022-10-04T17:22:31 Z rohith_231 Stove (JOI18_stove) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++..h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n,k; cin>>n>>k;
  vector<int>arr(n); for(int i=0;i<n;i++) cin>>arr[i];
  vector<int>diff(n-1);
  for(int i=0;i<n-1;i++) {
    diff[i] = arr[i+1]-arr[i]-1;
  }
   sort(diff.begin(),diff.end(),greater<int>());
  int res = arr[n-1]+1-arr[0];
  for(int i=0;i<k-1;i++) res-=diff[i];
  cout<<res<<endl;
  
  return 0;
}

Compilation message

stove.cpp:1:9: fatal error: bits/stdc++..h: No such file or directory
    1 | #include<bits/stdc++..h>
      |         ^~~~~~~~~~~~~~~~
compilation terminated.