제출 #548833

#제출 시각아이디문제언어결과실행 시간메모리
548833JokubasStove (JOI18_stove)C++14
0 / 100
0 ms212 KiB
#include <iostream> #include <bits/stdc++.h> #define pb push_back using namespace std; int main() { int N, K; cin>>N>>K; int kada[N]; for(int i = 0; i<N; i++) { cin>>kada[i]; } priority_queue<int> q; int praeitas = kada[0]; for(int i = 1; i<N; i++) { q.push(kada[i] - praeitas - 1); praeitas = kada[i]; } int ats = kada[N-1] - kada[0]; for(int i = 0; i<K-1; i++) { ats-=q.top(); q.pop(); } cout<<ats; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...