제출 #170619

#제출 시각아이디문제언어결과실행 시간메모리
170619mdn2002Stove (JOI18_stove)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> using namespace std; const long long mod=998244353; long long n,k; multiset<long long>ms; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen(".in","r",stdin); //freopen(".out","w",stdout); cin>>n>>k; int a,b; cin>>b; for(int i=0;i<n-1;i++) { cin>>a; ms.insert(a-b+1); b=a+1; } long long ans=0; for(int i=0;i<n-k;i++) { ans+=*ms.begin(); ms.erase(ms.begin()); } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...