# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303364 | 2020-09-20T09:03:43 Z | vipghn2003 | Stove (JOI18_stove) | C++14 | 1 ms | 384 KB |
#include<bits/stdc++.h> #define int long long using namespace std; main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,k; cin>>n>>k; k--; vector<int>a(n); priority_queue<int>pq; for(int i=0;i<n;i++) { cin>>a[i]; if(i) pq.push(a[i]-1-a[i-1]); } int res=a[n-1]; while(k--) { res-=pq.top(); pq.pop(); } cout<<res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |