Submission #792928

# Submission time Handle Problem Language Result Execution time Memory
792928 2023-07-25T11:09:54 Z naneosmic Stove (JOI18_stove) C++14
100 / 100
47 ms 2260 KB
#include <bits/stdc++.h>
using namespace std;
bool p(int a, int b){
if(a>b)return true;
return false;
}
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>vrijeme;
    vector<int>razmak;
    int a;
    cin>>a;
    vrijeme.push_back(a);
    int prosli=a+1;
    for(int i=0;i<n-1;i++){
        cin>>a;
        vrijeme.push_back(a);
        razmak.push_back(a-prosli);
        prosli=a+1;
    }
    sort(razmak.begin(),razmak.end(), p);
    int maks=vrijeme[n-1]+1-vrijeme[0];
    k--;
    for(int i=0;i<k;i++){
        maks-=razmak[i];
    }
    cout<<maks;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 308 KB Output is correct
12 Correct 2 ms 312 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 2 ms 308 KB Output is correct
12 Correct 2 ms 312 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 37 ms 2260 KB Output is correct
17 Correct 37 ms 2224 KB Output is correct
18 Correct 47 ms 2208 KB Output is correct
19 Correct 37 ms 2128 KB Output is correct
20 Correct 37 ms 2180 KB Output is correct
21 Correct 46 ms 2212 KB Output is correct
22 Correct 43 ms 2256 KB Output is correct
23 Correct 37 ms 2224 KB Output is correct
24 Correct 37 ms 2236 KB Output is correct