# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1113159 | Tyx2019 | Stove (JOI18_stove) | C++17 | 40 ms | 3312 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define INF 1e18
using namespace std;
int N, T;
int K[200005];
bool work(int tot){
int sum = 0;
for(int i=0;i<N;i++){
sum += tot/K[i];
if(sum >= T) return true;
}
if(sum >= T) return true;
else return false;
}
void solve(){
int N, K;
cin >> N >> K;
int T[N];
for(int i=0;i<N;i++) cin >> T[i];
int ans = N;
vector<int> V;
for(int i=1;i<N;i++) V.push_back(T[i] - T[i-1] - 1);
sort(V.begin(), V.end());
for(int i=0;i<N-K;i++){
ans += V[i];
}
cout << ans;
}
main(){
int T=1;
while(T--) solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |