Submission #492830

# Submission time Handle Problem Language Result Execution time Memory
492830 2021-12-09T06:51:23 Z watoKE Stove (JOI18_stove) C++17
0 / 100
0 ms 204 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

int n,m,a,b,c,cnt,g,f,d,e,cvp,k;
int dizi[100005];
int fark[100005];

int main()
{
    cin>>n>>k;
    for (int i=0;i<n;i++)
        cin>>dizi[i];
    for (int i=0;i<n-1;i++)
        fark[i]=dizi[i+1]-dizi[i]-1;
    sort(fark,fark+n-1);
    reverse(fark,fark+n-1);
    cvp=dizi[n-1]-dizi[1]+1;
    for (int i=0;i<k-1;i++)
         cvp-=fark[i];
    cout<<cvp;
    return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -