| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 481391 | anjamilicevic | Stove (JOI18_stove) | C++14 | 22 ms | 2064 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define IOS {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define MAXN 100005
int n, k, t[MAXN], d[MAXN];
using namespace std;
void solve()
{
cin >> n >> k ;
for(int i = 0 ; i < n ; i++)cin >> t[i] ;
for(int i = 0 ; i < n-1 ; i++)
{
d[i] = t[i+1]-t[i]-1 ;
}
int rez = t[n-1]+1-t[0] ;
sort(d,d+n-1);
reverse(d,d+n-1);
for(int i = 0 ; i < k-1 ; i++)
{
rez-=d[i];
}
cout << rez << endl ;
}
int main()
{
IOS ;
solve() ;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
