Submission #70169

#TimeUsernameProblemLanguageResultExecution timeMemory
701693zpStove (JOI18_stove)C++14
100 / 100
79 ms10536 KiB
#include<bits/stdc++.h> using namespace std; int n, k, t[100009]; vector<int> v; main(){ cin >> n >> k >> t[0]; for(int i = 1; i < n; i++){ cin >> t[i]; v.push_back(t[i] - t[i-1] - 1); } int ans = n; sort(v.begin(), v.end()); for(int i = 0; i < n - k; i++) ans += v[i]; cout<< ans << endl; }

Compilation message (stderr)

stove.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...