Submission #863832

# Submission time Handle Problem Language Result Execution time Memory
863832 2023-10-21T08:13:54 Z HataNoKokoro Stove (JOI18_stove) C++17
100 / 100
62 ms 6484 KB
#include <iostream>
#include <set>

using namespace std;

const int maxN = 1e5;

int n, k, res;
int T[maxN];
multiset<int, greater<int> > helper;

int main() {
    cin >> n >> k >> T[0];
    for(int i = 1; i < n; i++)
    {
        cin >> T[i];
        helper.insert(T[i] - T[i - 1]);
    }
    res = T[n - 1] - T[0];

    for(int i = 1; i < k; i++)
    {
        res -= *helper.begin();
        helper.erase(helper.begin());
    }
    cout << res + k;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 2 ms 600 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 2 ms 600 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 624 KB Output is correct
16 Correct 53 ms 6484 KB Output is correct
17 Correct 48 ms 6468 KB Output is correct
18 Correct 62 ms 6228 KB Output is correct
19 Correct 53 ms 6484 KB Output is correct
20 Correct 48 ms 6224 KB Output is correct
21 Correct 49 ms 6236 KB Output is correct
22 Correct 50 ms 6416 KB Output is correct
23 Correct 50 ms 6236 KB Output is correct
24 Correct 51 ms 6404 KB Output is correct