#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n,k;
cin >> n >> k;
pair<ll,ll> p[n];
for (int i=0;i<n;i++){
ll x,y;
cin >> x >> y;
p[i] = {x,y};
}
vector<ll> edge;
for (int i=0;i<n;i++){
for (int j=i+1;j<n;j++){
edge.push_back(abs(p[i].first-p[j].first)+abs(p[i].second-p[j].second));
}
}
sort(edge.begin(),edge.end());
for (int i=0;i<k;i++){
cout << edge[i] << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
6844 KB |
Output is correct |
2 |
Correct |
51 ms |
7120 KB |
Output is correct |
3 |
Correct |
33 ms |
5112 KB |
Output is correct |
4 |
Correct |
36 ms |
5320 KB |
Output is correct |
5 |
Correct |
53 ms |
6352 KB |
Output is correct |
6 |
Correct |
17 ms |
6352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1163 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
978 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
978 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
6844 KB |
Output is correct |
2 |
Correct |
51 ms |
7120 KB |
Output is correct |
3 |
Correct |
33 ms |
5112 KB |
Output is correct |
4 |
Correct |
36 ms |
5320 KB |
Output is correct |
5 |
Correct |
53 ms |
6352 KB |
Output is correct |
6 |
Correct |
17 ms |
6352 KB |
Output is correct |
7 |
Runtime error |
897 ms |
2097388 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
6844 KB |
Output is correct |
2 |
Correct |
51 ms |
7120 KB |
Output is correct |
3 |
Correct |
33 ms |
5112 KB |
Output is correct |
4 |
Correct |
36 ms |
5320 KB |
Output is correct |
5 |
Correct |
53 ms |
6352 KB |
Output is correct |
6 |
Correct |
17 ms |
6352 KB |
Output is correct |
7 |
Runtime error |
1163 ms |
2097156 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |