| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1370031 | chargeelectrum | Stove (JOI18_stove) | C++17 | 11 ms | 1480 KiB |
#include<bits/stdc++.h>
#define endl '\n'
#define sp ' '
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int n,k;
cin >> n >> k;
vector<int> a(n),dis;
for(int i=0;i<n;i++) cin >> a[i];
for(int i=1;i<n;i++) dis.push_back(a[i]-a[i-1]-1);
sort(dis.begin(),dis.end());
int del=0;
while(--k){
del+=dis.back();
dis.pop_back();
}
cout << a.back()+1-a.front()-del;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
