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
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int N, K;
cin >> N >> K;
vector<int> dist;
vector<pair<int, int>> pos(N);
for (int i = 0; i < N; i++) cin >> pos[i].first >> pos[i].second;
for (int i = 1; i < N; i++) {
for (int j = 0; j < i; j++) {
dist.push_back(abs(pos[i].first - pos[j].first) + abs(pos[i].second - pos[j].second));
}
}
sort(dist.begin(), dist.end());
for (int i = 0; i < K; i++) cout << dist[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... |