Submission #528551

# Submission time Handle Problem Language Result Execution time Memory
528551 2022-02-20T14:03:33 Z groshi Stove (JOI18_stove) C++17
0 / 100
1 ms 204 KB
#include<iostream>
#include<queue>
using namespace std;
priority_queue<int> kolejka;
int t[1000000];
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>t[i];
    int wynik=t[n]-t[0]+1;
    k--;
    for(int i=1;i<n;i++)
        kolejka.push(t[i+1]-t[i]);
    for(int i=1;i<=k;i++)
    {
        int mam=kolejka.top();
        wynik-=mam;
        kolejka.pop();
    }
    cout<<wynik;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -