Submission #1002209

# Submission time Handle Problem Language Result Execution time Memory
1002209 2024-06-19T10:59:06 Z zh_h Stove (JOI18_stove) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
#define lint long long
#define pb push_back
#define mp make_pair
using namespace std;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, k;
    cin >> n >> k;
    vector<int> v;
    for(int i = 0; i < n; i ++){
        int temp;
        cin >> temp;
        v.pb(temp);
    }

    vector<int> vb;
    for(int i = 1; i < n; i ++){
        vb.pb(v[i]-v[i-1]-1);
    }

    sort(vb.begin(), vb.end());

    for(auto i : vb){cout << i << " ";} cout << endl;

    int time = n;
    
    if(k >= n){cout << n;}
    else{
        for(int i = 0; i < n-k; i ++){
            time+=vb[i];
        }
        cout << time;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -