Submission #70169

# Submission time Handle Problem Language Result Execution time Memory
70169 2018-08-22T12:24:58 Z 3zp Stove (JOI18_stove) C++14
100 / 100
79 ms 10536 KB
#include<bits/stdc++.h>
using namespace std;
int n, k, t[100009];
vector<int> v;
main(){
    cin >> n >> k >> t[0];
    for(int i = 1; i < n; i++){
        cin >> t[i];
        v.push_back(t[i] - t[i-1] - 1);
    }
    int ans = n;
    sort(v.begin(), v.end());
    for(int i = 0; i < n - k; i++)
        ans += v[i];
    cout<< ans << endl;

}

Compilation message

stove.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 388 KB Output is correct
2 Correct 4 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
6 Correct 3 ms 568 KB Output is correct
7 Correct 2 ms 680 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 4 ms 680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 388 KB Output is correct
2 Correct 4 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
6 Correct 3 ms 568 KB Output is correct
7 Correct 2 ms 680 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 4 ms 680 KB Output is correct
10 Correct 5 ms 752 KB Output is correct
11 Correct 6 ms 784 KB Output is correct
12 Correct 5 ms 832 KB Output is correct
13 Correct 5 ms 864 KB Output is correct
14 Correct 6 ms 956 KB Output is correct
15 Correct 6 ms 960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 388 KB Output is correct
2 Correct 4 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 564 KB Output is correct
6 Correct 3 ms 568 KB Output is correct
7 Correct 2 ms 680 KB Output is correct
8 Correct 2 ms 680 KB Output is correct
9 Correct 4 ms 680 KB Output is correct
10 Correct 5 ms 752 KB Output is correct
11 Correct 6 ms 784 KB Output is correct
12 Correct 5 ms 832 KB Output is correct
13 Correct 5 ms 864 KB Output is correct
14 Correct 6 ms 956 KB Output is correct
15 Correct 6 ms 960 KB Output is correct
16 Correct 79 ms 2916 KB Output is correct
17 Correct 63 ms 3760 KB Output is correct
18 Correct 68 ms 4720 KB Output is correct
19 Correct 70 ms 5824 KB Output is correct
20 Correct 70 ms 6688 KB Output is correct
21 Correct 65 ms 7612 KB Output is correct
22 Correct 71 ms 8584 KB Output is correct
23 Correct 65 ms 9568 KB Output is correct
24 Correct 64 ms 10536 KB Output is correct