# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
206697 |
2020-03-04T16:00:32 Z |
shortbread1 |
Stove (JOI18_stove) |
C++14 |
|
81 ms |
2936 KB |
#include<bits/stdc++.h>
using namespace std;
long long int t[100005],razlika[100005];
int n,k;
int main()
{
cin>>n>>k;
for (int i=0;i<n;i++)
{
cin>>t[i];
}
long long int max_razlika=t[n-1]-t[0]+1;
for (int i=1;i<n;i++)
{
razlika[i-1]=t[i]-t[i-1];
}
//for (int i=0;i<n-1;i++) cout<<razlika[i]<<endl;
//cout<<max_razlika<<endl;
sort(razlika,razlika+n-1);
int br=0;
long long int ukupno=0;
while (br<k-1)
{
ukupno+=razlika[n-2-br]-1;
br++;
}
cout<<max_razlika-ukupno;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
7 ms |
376 KB |
Output is correct |
11 |
Correct |
7 ms |
376 KB |
Output is correct |
12 |
Correct |
7 ms |
376 KB |
Output is correct |
13 |
Correct |
7 ms |
376 KB |
Output is correct |
14 |
Correct |
7 ms |
376 KB |
Output is correct |
15 |
Correct |
7 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
7 ms |
376 KB |
Output is correct |
11 |
Correct |
7 ms |
376 KB |
Output is correct |
12 |
Correct |
7 ms |
376 KB |
Output is correct |
13 |
Correct |
7 ms |
376 KB |
Output is correct |
14 |
Correct |
7 ms |
376 KB |
Output is correct |
15 |
Correct |
7 ms |
376 KB |
Output is correct |
16 |
Correct |
75 ms |
2808 KB |
Output is correct |
17 |
Correct |
81 ms |
2936 KB |
Output is correct |
18 |
Correct |
74 ms |
2808 KB |
Output is correct |
19 |
Correct |
72 ms |
2808 KB |
Output is correct |
20 |
Correct |
74 ms |
2808 KB |
Output is correct |
21 |
Correct |
74 ms |
2808 KB |
Output is correct |
22 |
Correct |
76 ms |
2808 KB |
Output is correct |
23 |
Correct |
74 ms |
2680 KB |
Output is correct |
24 |
Correct |
74 ms |
2808 KB |
Output is correct |