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;
typedef long long ll;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n,k;
cin >> n >> k;
pair<ll,ll> p[n];
for (int i=0;i<n;i++){
ll x,y;
cin >> x >> y;
p[i] = {x,y};
}
vector<ll> edge;
for (int i=0;i<n;i++){
for (int j=i+1;j<n;j++){
edge.push_back(abs(p[i].first-p[j].first)+abs(p[i].second-p[j].second));
}
}
sort(edge.begin(),edge.end());
for (int i=0;i<k;i++){
cout << edge[i] << "\n";
}
}
# | 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... |