Submission #543753

# Submission time Handle Problem Language Result Execution time Memory
543753 2022-03-31T10:01:11 Z tudor Stove (JOI18_stove) C++17
100 / 100
56 ms 1632 KB
#include <iostream>
#include <algorithm>
using namespace std;
const int nmax = 1e5;
int v[nmax];
int main() {
    int n, k, a, b;
    cin >> n >> k >> a;
    for ( int i = 1; i < n; i++ ) {
        cin >> b;
        v[i] = b - a - 1;
        a = b;
    }

    sort ( v + 1, v + n );

    int s = n;
    for ( int i = 1; i <= n - k; i++ )
        s += v[i];

    cout << s;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 44 ms 1536 KB Output is correct
17 Correct 45 ms 1632 KB Output is correct
18 Correct 44 ms 1568 KB Output is correct
19 Correct 43 ms 1612 KB Output is correct
20 Correct 43 ms 1584 KB Output is correct
21 Correct 43 ms 1584 KB Output is correct
22 Correct 43 ms 1612 KB Output is correct
23 Correct 56 ms 1560 KB Output is correct
24 Correct 43 ms 1600 KB Output is correct