| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1339330 | yyc000123 | Stove (JOI18_stove) | C++20 | 31 ms | 5508 KiB |
#include<bits/stdc++.h>
using namespace std ;
const int N = 1e5+5 ;
int n , k , arr[N] , ans ;
multiset<int> mst ;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) ;
cin >> n >> k ;
for(int i=1 ; i<=n ; i++){
cin >> arr[i] ;
if(i>1) mst.insert(arr[i]-arr[i-1]-1) ;
}
while(mst.size()>=k){
ans+=*mst.begin() ;
mst.erase(mst.begin()) ;
}
cout << ans+n << '\n' ;
return 0 ;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
