Submission #366224

# Submission time Handle Problem Language Result Execution time Memory
366224 2021-02-13T14:55:15 Z Tuk1352 Stove (JOI18_stove) C++11
100 / 100
61 ms 2276 KB
#include <bits/stdc++.h>

using namespace std;

int main ()
{
    int n, k, S;
    cin >> n >> k;
    int T[n];
    vector <int> V;
    for (int i = 0; i < n; i++)
    {
        cin >> T[i];
        if (i != 0)
        {
            V.push_back(T[i]-T[i-1]-1);
        }
    }
    sort(V.rbegin(),V.rend());
    S = T[n-1] - T[0] + 1;
    for (int i = 0; i < k-1; i++)
    {
        S -= V[i];
    }
    cout << S;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 2 ms 364 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 2 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 51 ms 2192 KB Output is correct
17 Correct 50 ms 2152 KB Output is correct
18 Correct 54 ms 2276 KB Output is correct
19 Correct 61 ms 2152 KB Output is correct
20 Correct 57 ms 2276 KB Output is correct
21 Correct 50 ms 2152 KB Output is correct
22 Correct 50 ms 2172 KB Output is correct
23 Correct 52 ms 2152 KB Output is correct
24 Correct 51 ms 2152 KB Output is correct