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;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 3e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
int n, k;
ii a[N];
priority_queue<int, vector<int>, greater<int>> pq;
void process(){
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
for(int i = 1; i <= n; i++){
for(int j = i + 1; j <= n; j++){
pq.push({abs(a[i].fi - a[j].fi) + abs(a[i].se - a[j].se)});
//if(pq.size() > k) pq.pop();
}
}
for(int i = 1; i <= k; i++){
cout << pq.top() << "\n";
pq.pop();
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
process();
}
# | 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... |