#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
const int MN = 250005;
int n, k, x, y;
pii a[MN];
int cost(pii p, pii q) {
return max(abs(p.f - q.f), abs(p.s - q.s));
}
bool cmp(pii p, pii q) {
return cost(a[p.f], a[p.s]) > cost(a[q.f], a[q.s]);
}
int32_t main() {
boost();
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> x >> y;
a[i] = {x + y, x - y};
}
vector<int> v;
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
v.push_back(cost(a[i], a[j]));
}
}
sort(v.begin(), v.end());
for (int i = 1; i <= k; i++) printf("%lld\n", v[i - 1]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
6960 KB |
Output is correct |
2 |
Correct |
81 ms |
6952 KB |
Output is correct |
3 |
Correct |
56 ms |
5048 KB |
Output is correct |
4 |
Correct |
55 ms |
5040 KB |
Output is correct |
5 |
Correct |
78 ms |
5808 KB |
Output is correct |
6 |
Correct |
24 ms |
4548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2105 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1952 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1952 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
6960 KB |
Output is correct |
2 |
Correct |
81 ms |
6952 KB |
Output is correct |
3 |
Correct |
56 ms |
5048 KB |
Output is correct |
4 |
Correct |
55 ms |
5040 KB |
Output is correct |
5 |
Correct |
78 ms |
5808 KB |
Output is correct |
6 |
Correct |
24 ms |
4548 KB |
Output is correct |
7 |
Runtime error |
1856 ms |
2097156 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
6960 KB |
Output is correct |
2 |
Correct |
81 ms |
6952 KB |
Output is correct |
3 |
Correct |
56 ms |
5048 KB |
Output is correct |
4 |
Correct |
55 ms |
5040 KB |
Output is correct |
5 |
Correct |
78 ms |
5808 KB |
Output is correct |
6 |
Correct |
24 ms |
4548 KB |
Output is correct |
7 |
Runtime error |
2105 ms |
2097156 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |