Submission #539075

#TimeUsernameProblemLanguageResultExecution timeMemory
539075ivazivaStove (JOI18_stove)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin>>n>>k; int niz[n]; int pauze[n]; for (int i=0;i<n;i++) { cin>>niz[i]; if (i!=0) { pauze[i-1]=niz[i]-niz[i-1]; } } sort(pauze,pauze+n-1); int t=n; for (int i=0;i<n-k;i++) { t+=pauze[i]; } cout<<t<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...