# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992350 | Kalata_56 | Road Construction (JOI21_road_construction) | C++14 | 10028 ms | 8744 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>
using namespace std;
pair<long long,long long> kor[250001];
priority_queue<long long> kol;
vector<long long> rez;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
long long N,K;
cin>>N>>K;
for(long long i=0;i<N;i++){
cin>>kor[i].first>>kor[i].second;
}
sort(kor,kor+N);
for(int k=1;k<N;k++){
for(long long i=k;i<N;i++){
long long raz=abs(kor[i].first-kor[i-k].first)+abs(kor[i].second-kor[i-k].second);
kol.push(raz);
if(kol.size()>K){
kol.pop();
}
}
if(k>=1000){
break;
}
}
while(!kol.empty()){
rez.push_back(kol.top());
kol.pop();
}
sort(rez.begin(),rez.end());
for(long long i=0;i<K;i++){
cout<<rez[i]<<endl;
}
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... |