#include <bits/stdc++.h>
#define pb push_back
#define endl ("\n")
#define all(aa) aa.begin(), aa.end()
typedef long long ll;
using namespace std;
int main(){
int n, k;
cin >> n >> k;
vector<pair<ll, ll>> v(n);
for(int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
auto calc = [&](pair<ll, ll> a, pair<ll, ll> b){
return abs(a.first - b.first) + abs(a.second - b.second);
};
priority_queue<ll, vector<ll>, greater<ll>> pq;
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
pq.push(calc(v[i], v[j]));
}
}
for(int i = 0; i < k; i++){
cout << pq.top() << endl;
pq.pop();
}
}
# | 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... |