| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1214495 | adriines06 | Stove (JOI18_stove) | C++20 | 14 ms | 1480 KiB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n,k; cin>>n>>k;
vector<int>t(n);
vector<int>dif;
for(int &x: t) cin>>x;
for(int i=1;i<n;i++){
int a=t[i]-t[i-1]-1;
dif.push_back(a);
}
sort(dif.begin(),dif.end());
//for(int x: dif) cout<<x<<" ";
int sum=0;
for(int i=0;i<=n-k-1;i++){
sum+=dif[i];
}
cout<<n+sum;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
