| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1331097 | yumemystery | Stove (JOI18_stove) | C++17 | 41 ms | 1436 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
vector<int>guest(n);
for (auto &a : guest) {
cin >> a;
}
priority_queue<int,vector<int>,greater<int>>pq;
for (int i=1; i<n; i++) {
pq.push(guest[i]-guest[i-1]-1);
}
int ans = n;
while (!pq.empty() && pq.size() > k-1) {
ans += pq.top();
pq.pop();
}
cout << ans;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
