# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
415496 | 2021-06-01T07:28:24 Z | 조영욱(#7635) | Road Construction (JOI21_road_construction) | C++17 | 210 ms | 7520 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; typedef pair<long long,P> iP; long long arr[250000]; int main(void) { int n,k; scanf("%d %d",&n,&k); int x; for(int i=0;i<n;i++) { scanf("%lld %d",&arr[i],&x); } sort(arr,arr+n); priority_queue<iP,vector<iP>,greater<iP>> pq; for(int i=0;i<n-1;i++) { pq.push(iP(arr[i+1]-arr[i],P(i,i+1))); } vector<long long> ret; for(int i=0;i<k;i++) { printf("%lld\n",pq.top().first); P got=pq.top().second; pq.pop(); if (got.second!=n-1) { pq.push(iP(arr[got.second+1]-arr[got.first],P(got.first,got.second+1))); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 56 ms | 2672 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 208 ms | 7428 KB | Output is correct |
2 | Correct | 210 ms | 7480 KB | Output is correct |
3 | Correct | 56 ms | 2812 KB | Output is correct |
4 | Correct | 147 ms | 7208 KB | Output is correct |
5 | Correct | 140 ms | 7520 KB | Output is correct |
6 | Correct | 138 ms | 7420 KB | Output is correct |
7 | Correct | 137 ms | 6696 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 108 ms | 6452 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 108 ms | 6452 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 56 ms | 2672 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 56 ms | 2672 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |