| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1257283 | m_a_d | Stove (JOI18_stove) | C++20 | 57 ms | 5800 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
int n, k;
cin >> n >> k;
int guests[n];
multiset<int> st;
for(int i=0; i<n; ++i) cin >> guests[i];
for(int i=1; i<n; ++i) st.insert(guests[i]-guests[i-1]-1);
//for(auto elem: st) cout << elem << " ";
int ans=n;
while(n>k && !st.empty()) {
ans+=*st.begin();
st.erase(st.begin());
n--;
//cout << n;
}
cout << ans;
return 0;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
