#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,k;
cin >> n >> k;
ll x[n+2];
ll y[n+2];
vector <ll> v;
for(ll i=0;i<n;i++){
cin >> x[i] >> y[i];
}
for(ll i=0;i<n;i++){
for(ll j=i+1;j<n;j++){
v.push_back(abs(x[i]-x[j])+abs(y[i]-y[j]));
}
}
sort(v.begin(),v.end());
if(k==1){
cout << v[0];
}
else{
for(ll i=0;i<k;i++){
cout << v[i] << "\n";
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
7076 KB |
Output is correct |
2 |
Correct |
60 ms |
6940 KB |
Output is correct |
3 |
Correct |
40 ms |
4984 KB |
Output is correct |
4 |
Correct |
42 ms |
5108 KB |
Output is correct |
5 |
Correct |
55 ms |
5832 KB |
Output is correct |
6 |
Correct |
20 ms |
4556 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1567 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1506 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1506 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
7076 KB |
Output is correct |
2 |
Correct |
60 ms |
6940 KB |
Output is correct |
3 |
Correct |
40 ms |
4984 KB |
Output is correct |
4 |
Correct |
42 ms |
5108 KB |
Output is correct |
5 |
Correct |
55 ms |
5832 KB |
Output is correct |
6 |
Correct |
20 ms |
4556 KB |
Output is correct |
7 |
Runtime error |
1435 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
7076 KB |
Output is correct |
2 |
Correct |
60 ms |
6940 KB |
Output is correct |
3 |
Correct |
40 ms |
4984 KB |
Output is correct |
4 |
Correct |
42 ms |
5108 KB |
Output is correct |
5 |
Correct |
55 ms |
5832 KB |
Output is correct |
6 |
Correct |
20 ms |
4556 KB |
Output is correct |
7 |
Runtime error |
1567 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |