Submission #978251

# Submission time Handle Problem Language Result Execution time Memory
978251 2024-05-09T04:48:20 Z IPZ Stove (JOI18_stove) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin >> a >> b;
    vector<int>in,out;
    priority_queue<int>pq;
    for(int i=0;i<a;i++)
    {
        int c;
        cin >> c;
        in.push_back(c);
        out.push_back(c+1);
        pq.push(in[i]-out[i-1]);
    }
    //out->in(out+1) to minus
    int now=out[a-1]-in[0];
    b--;
    while(b--)
    {
        now-=pq.top();
        pq.pop();
    }
    cout << now;
    

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -