#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000
#define MOD 1000000007
const int B = 750;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, k;
cin >> n >> k;
int x[n], y[n];
for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
priority_queue<int, vector<int>, greater<int>> pq;
sort(x, x+n);
for(int i = 0; i < n; i++) {
for(int j = i+1; j < min(n, i+B); j++) {
pq.push(x[j]-x[i]);
if((int)pq.size() > k) pq.pop();
}
}
while(pq.size()) {
cout << pq.top() << '\n';
pq.pop();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
5064 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9220 ms |
8240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1050 ms |
4336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1050 ms |
4336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
5064 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
5064 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |