| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1290461 | azradudukalay | Stove (JOI18_stove) | C++20 | 37 ms | 1056 KiB |
#include <bits/stdc++.h>
using namespace std;
int n,k,temp,temp1,nk,ans;
vector <int> fark;
int main()
{
int n,k,temp,temp1,nk,ans=0;
vector <int> fark;
cin>>n>>k;
for(int j = 0; j<n; ++j)
{
cin>>temp;
if(j != 0) fark.push_back(temp-(temp1+1));
temp1 = temp;
}
nk = fark.size();
sort(fark.begin(),fark.end());
for(int j = nk-1; k-1 != 0; --j)
{
fark[j] = 0;
--k;
}
for(int j = 0; j<nk; ++j)
{
ans += fark[j];
}
cout<<ans+n;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
