제출 #383072

#제출 시각아이디문제언어결과실행 시간메모리
383072MODDIStove (JOI18_stove)C++14
100 / 100
54 ms2156 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long signed main(){ ll n, k; cin >> n >> k; ll diff[n-1], x, y; cin >> x; for(int i=0; i<n-1; ++i){ cin >> y; diff[i] = y-x-1; x = y; } sort(diff, diff+n); ll ans = 0; for(int i=0; i<n-k; ++i) ans += diff[i]; cout << ans+n; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...