Submission #1109069

# Submission time Handle Problem Language Result Execution time Memory
1109069 2024-11-06T01:22:20 Z ozner77 Stove (JOI18_stove) C++17
0 / 100
1 ms 336 KB
#define ll long long
#define pb push_back
#include <bits/stdc++.h>
using namespace std;
int main(){
    ll a,b,c,ant;
    cin>>a>>b;
    ll res=a;
    vector<ll> V;
    if(b<a){
        ll con=0;
        while(a--){
        cin>>c;
        if(con>0){
            V.push_back(c-ant);
        }
        con++;
        ant=c;
        }
        sort(V.begin(),V.end());
        ll xd=res-b;
        for(int i=0;i<xd;i++){
            res--;
            res+=V[i];
        }
        cout<<res;
    }else{
        while(a--){
        cin>>c;
        }
        cout<<a;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 1 ms 336 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 1 ms 336 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Incorrect 1 ms 336 KB Output isn't correct
6 Halted 0 ms 0 KB -