Submission #648181

# Submission time Handle Problem Language Result Execution time Memory
648181 2022-10-05T16:24:24 Z vnjs Stove (JOI18_stove) C++14
100 / 100
51 ms 1060 KB
#include <bits/stdc++.h>
#define ll unsigned long long

using namespace std;

int main()
{
    ll n, k; cin >> n >> k;
    ll d = n-k;
    ll difs[n-1];
    ll a, b;
    ll rez=n;
    for(ll i = 0; i < n; i++){
        a=b;
        cin >> b;
        if(i==0)continue;
        difs[i-1]=b-a;
    }
    sort(difs, difs+n-1);
    for(ll i = 0; i < d;i++){
            //cout << difs[i] << '\n';
        rez+=difs[i]-1;
    }
    cout << rez << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 2 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 44 ms 980 KB Output is correct
17 Correct 44 ms 1052 KB Output is correct
18 Correct 47 ms 980 KB Output is correct
19 Correct 51 ms 980 KB Output is correct
20 Correct 45 ms 1056 KB Output is correct
21 Correct 43 ms 1052 KB Output is correct
22 Correct 43 ms 980 KB Output is correct
23 Correct 43 ms 980 KB Output is correct
24 Correct 43 ms 1060 KB Output is correct