Submission #966989

# Submission time Handle Problem Language Result Execution time Memory
966989 2024-04-20T19:49:55 Z ach00 Stove (JOI18_stove) C++17
0 / 100
0 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int n,k; cin >> n >> k;
    ll mxt = 0;
    ll mnt =  1000000005;
    vector<ll> dst;
    cin >> mnt;
    ll prev = mnt;
    k--;
    for(int i = 1; i < n; i++) {
        ll t; cin >> t;
        dst.push_back(t-prev-1);
        mxt = max(mxt, t);
        prev = t;
    }
    sort(dst.rbegin(), dst.rend());
    ll eft = 0;
    for(int i = 0; i < k; i++) {
        eft += dst[i];
    }
    ll tet = mxt-mnt+1;
    cout << tet-eft;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -