Submission #990832

# Submission time Handle Problem Language Result Execution time Memory
990832 2024-05-31T13:08:38 Z 12345678 Road Construction (JOI21_road_construction) C++17
0 / 100
113 ms 18348 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=250005;

ll n, k, x[nx], y;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>k;
    for (int i=0; i<n; i++) cin>>x[i]>>y;
    sort(x, x+n);
    priority_queue<tuple<ll, ll, ll>, vector<tuple<ll, ll, ll>>, greater<tuple<ll, ll, ll>>> pq;
    for (int i=0; i<n-1; i++) pq.push({x[i+1]-x[i], i, i+1});
    for (int t=1; t<=k; t++)
    {
        auto [d, a, b]=pq.top();
        pq.pop();
        cout<<d<<'\n';
        if (a!=0) pq.push({x[b]-x[a-1], a-1, b});
        if (b!=n-1) pq.push({x[b+1]-x[a], a, b+1});
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 8608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 18348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 14784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 14784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 8608 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 8608 KB Output isn't correct
2 Halted 0 ms 0 KB -