# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1035918 |
2024-07-26T19:13:49 Z |
clementine |
Stove (JOI18_stove) |
C++17 |
|
38 ms |
2288 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int guest[100005];
vector<int> differences;
int n, k;
int main()
{
cin >> n >> k;
cin >> guest[1];
for(int i = 2; i <= n; i ++)
{
cin >> guest[i];
differences.push_back(guest[i] - guest[i-1] -1);
}
sort(differences.begin(), differences.end());
//cout << differences[0] << " ";
int d = n - k;
int tot = n;
for(int i = 0; i <d; i ++)
{
tot += differences[i];
}
cout << tot;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
34 ms |
2260 KB |
Output is correct |
17 |
Correct |
29 ms |
2056 KB |
Output is correct |
18 |
Correct |
38 ms |
2252 KB |
Output is correct |
19 |
Correct |
30 ms |
2288 KB |
Output is correct |
20 |
Correct |
29 ms |
2260 KB |
Output is correct |
21 |
Correct |
29 ms |
2092 KB |
Output is correct |
22 |
Correct |
30 ms |
2248 KB |
Output is correct |
23 |
Correct |
30 ms |
2252 KB |
Output is correct |
24 |
Correct |
30 ms |
2260 KB |
Output is correct |