Submission #976737

#TimeUsernameProblemLanguageResultExecution timeMemory
976737SeenSiravitStove (JOI18_stove)C++14
100 / 100
19 ms1920 KiB
#include<bits/stdc++.h> using namespace std; int n,k; int main(){ ios::sync_with_stdio(0),cin.tie(0); cin>> n >> k; priority_queue<int> pq; int sum = 0; int first_t; cin>> first_t; int dummy = first_t + 1; for(int i=1;i<n;i++){ int t; cin>> t; pq.push(t - dummy); dummy = t+1; } int reduce = 0; while(!pq.empty() && k-->1){ reduce += pq.top(); pq.pop(); } cout<< dummy - first_t - reduce; return 0; }

Compilation message (stderr)

stove.cpp: In function 'int main()':
stove.cpp:13:9: warning: unused variable 'sum' [-Wunused-variable]
   13 |     int sum = 0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...