# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
159243 |
2019-10-21T15:18:59 Z |
kimbj0709 |
Stove (JOI18_stove) |
C++17 |
|
86 ms |
2836 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
int no_of_input,matches;
int input;
vector<int> vect1;
int ans = 0;
vector<int> diff;
cin >> no_of_input >> matches;
for(int i=0;i<no_of_input;i++){
cin >> input;
vect1.push_back(input);
}
for(int i=1;i<no_of_input;i++){
diff.push_back(vect1[i]-vect1[i-1]);
}
sort(diff.begin(),diff.end());
for(int i=0;i<no_of_input-matches;i++){
ans += diff[i];
}
cout << ans+matches;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
4 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
4 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
4 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
4 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
4 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
376 KB |
Output is correct |
15 |
Correct |
4 ms |
504 KB |
Output is correct |
16 |
Correct |
86 ms |
2604 KB |
Output is correct |
17 |
Correct |
85 ms |
2608 KB |
Output is correct |
18 |
Correct |
85 ms |
2664 KB |
Output is correct |
19 |
Correct |
86 ms |
2672 KB |
Output is correct |
20 |
Correct |
85 ms |
2836 KB |
Output is correct |
21 |
Correct |
86 ms |
2616 KB |
Output is correct |
22 |
Correct |
85 ms |
2664 KB |
Output is correct |
23 |
Correct |
85 ms |
2664 KB |
Output is correct |
24 |
Correct |
85 ms |
2668 KB |
Output is correct |