# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
230975 |
2020-05-12T08:29:54 Z |
peijar |
Stove (JOI18_stove) |
C++17 |
|
33 ms |
2176 KB |
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
using ll = long long;
int main(void)
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int nb_personnes, nb_allumetes;
cin >> nb_personnes >> nb_allumetes;
vector<int> arrivees(nb_personnes);
for (auto &v : arrivees)
cin >> v;
ll tot_cost(arrivees.back() + 1 - arrivees[0]);
vector<int> suppresions(nb_personnes-1);
for (int i(0); i < nb_personnes-1; ++i)
suppresions[i] = arrivees[i+1] - arrivees[i]-1;
sort(suppresions.rbegin(), suppresions.rend());
for (int i(0); i < nb_allumetes-1; ++i)
tot_cost -= suppresions[i];
cout << tot_cost << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
6 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
31 ms |
1152 KB |
Output is correct |
17 |
Correct |
29 ms |
2048 KB |
Output is correct |
18 |
Correct |
29 ms |
2048 KB |
Output is correct |
19 |
Correct |
28 ms |
2048 KB |
Output is correct |
20 |
Correct |
30 ms |
2048 KB |
Output is correct |
21 |
Correct |
33 ms |
2048 KB |
Output is correct |
22 |
Correct |
28 ms |
2048 KB |
Output is correct |
23 |
Correct |
28 ms |
2176 KB |
Output is correct |
24 |
Correct |
29 ms |
2048 KB |
Output is correct |