제출 #1124819

#제출 시각아이디문제언어결과실행 시간메모리
1124819justin271828Stove (JOI18_stove)C++20
100 / 100
39 ms1436 KiB
#include <bits/stdc++.h> using namespace std; #define sigma int sigma main() { sigma N, K; cin >> N >> K; sigma T[N]; for (sigma i = 0; i < N; i++) cin >> T[i]; sigma ans = T[N-1] - T[0] + 1; priority_queue<sigma> pq; for (sigma i = 1; i < N; i++) pq.push(T[i] - T[i-1] - 1); for (sigma i = 1; i < K; i++) { ans -= pq.top(); pq.pop();} cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...