# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
507243 | amukkalir | Stove (JOI18_stove) | C++17 | 33 ms | 2140 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define se second
#define fi first
#define pb push_back
#define wek puts("wekwek")
#define wik puts("-------")
const int nax = 1e5;
int n, k;
int t[nax+5];
signed main () {
scanf("%d %d", &n, &k);
priority_queue<int,vector<int>,greater<int>> pq;
int ans = n;
for(int i=0; i<n; i++) {
scanf("%d", &t[i]);
if(i > 0) {
pq.push(t[i]-t[i-1]-1);
}
}
for(int i=0; i<n-k; i++) {
ans += pq.top();
pq.pop();
}
printf("%d", ans);
}
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |