Submission #940356

# Submission time Handle Problem Language Result Execution time Memory
940356 2024-03-07T08:26:16 Z codefox Stove (JOI18_stove) C++14
100 / 100
49 ms 1780 KB
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;

    vector<int> dist(n-1);
    int last;
    cin >> last;
    for (int i= 1; i < n; i++)
    {
        int t;
        cin >> t;
        dist[i-1] = t-last-1;
        last = t;
    }

    sort(dist.begin(), dist.end());

    int sol = n;
    for (int i = 0; i < n-k; i++) sol += dist[i];
    cout << sol << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 436 KB Output is correct
6 Correct 1 ms 436 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 436 KB Output is correct
6 Correct 1 ms 436 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 476 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 436 KB Output is correct
6 Correct 1 ms 436 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 476 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 35 ms 1708 KB Output is correct
17 Correct 35 ms 1628 KB Output is correct
18 Correct 35 ms 1712 KB Output is correct
19 Correct 35 ms 1720 KB Output is correct
20 Correct 36 ms 1780 KB Output is correct
21 Correct 47 ms 1708 KB Output is correct
22 Correct 36 ms 1580 KB Output is correct
23 Correct 41 ms 1628 KB Output is correct
24 Correct 49 ms 1776 KB Output is correct