| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1331947 | bobmath | Stove (JOI18_stove) | C++20 | 36 ms | 1044 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N,K;
cin >> N >> K;
int A,B,last;
vector<int> len;
for(int i = 0; i < N; i++){
int t; cin >> t;
if (i==0) A=t;
if (i==N-1) B=t+1;
if (0<i) len.push_back(t-last-1);
last=t;
}
sort(len.begin(),len.end(),greater());
int ans= B - A;
for (int i=0; i<K-1; i++) ans-=len[i];
cout<<ans<<'\n';
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
