Submission #836004

# Submission time Handle Problem Language Result Execution time Memory
836004 2023-08-24T04:43:41 Z exodus_ Stove (JOI18_stove) C++14
100 / 100
46 ms 2288 KB
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
int guest[maxn];
int main() {
    int N, K;
    cin >> N >> K;
    priority_queue<int, vector<int>, greater<int>>pq;
    for(int i=1; i<=N; i++) {
        cin >> guest[i];
    }
    int oprtime = N;
    for(int i=2; i<=N; i++) {
        int valtime = guest[i]-guest[i-1];
        pq.push(valtime-1);
    }
    for(int i=1; i<=N-K; i++) {
        oprtime+=pq.top();
        pq.pop();
    }
    cout << oprtime << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 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 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 1 ms 340 KB Output is correct
13 Correct 1 ms 264 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 1 ms 340 KB Output is correct
13 Correct 1 ms 264 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 46 ms 2280 KB Output is correct
17 Correct 38 ms 2244 KB Output is correct
18 Correct 38 ms 2228 KB Output is correct
19 Correct 38 ms 2256 KB Output is correct
20 Correct 34 ms 2204 KB Output is correct
21 Correct 31 ms 2288 KB Output is correct
22 Correct 29 ms 2276 KB Output is correct
23 Correct 30 ms 2172 KB Output is correct
24 Correct 30 ms 2248 KB Output is correct