| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1271594 | david_g611 | Stove (JOI18_stove) | C++20 | 36 ms | 2240 KiB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
int n, k;
cin>>n>>k;
int t[n+1];
vector<int> free;
int ans=n;
for(int i=1; i<=n; i++)
{
cin>>t[i];
if(i>1)
free.push_back(t[i]-t[i-1]-1);
}
sort(free.begin(), free.end());
int choose = n-k;
for(int i=0; i<choose; i++)
ans+=free[i];
cout<<ans;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
