# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
793528 | fuad27 | Road Construction (JOI21_road_construction) | C++17 | 10048 ms | 5192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
void solve() {
int n, k;
cin >> n >> k;
int x[n], y[n];
priority_queue<unsigned int> pq;
for(int i = 0;i<n;i++) {
cin >> x[i] >> y[i];
}
for(int i = 0;i<n;i++)
for(int j = i+1;j<n;j++){
pq.push((unsigned int)abs(x[i]-x[j])+abs(y[i]-y[j]));
while(pq.size()>k) {
pq.pop();
}
}
vector<unsigned int> v;
while(pq.size()){
v.push_back(pq.top());
pq.pop();
}
for(int i=v.size()-1;i>=0;i--)cout << v[i] << "\n";
}
int main () {
cin.tie(0)->sync_with_stdio(0);
int t=1;
while(t--)solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |