| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1140465 | vikofaz | Stove (JOI18_stove) | C++20 | 42 ms | 964 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
// freopen("input","r",stdin);
// freopen("output","w",stdout);
int n,k;
cin >> n >> k;
int a, total =1;
vector<int> v;
for(int i=1; i<=n;i++){
int b;
cin >> b;
if(i>1){
v.push_back(b-a-1);
total += b-a;
}
a=b;
}
sort(v.rbegin(),v.rend());
for(int i=0;i<k-1;i++){
total -= v[i];
}
cout << total << endl;
return 0;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
