#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("avx,avx2")
#define Respaabs1equal2xdoner cin.tie(nullptr)->sync_with_stdio(false);
#define pll pair < long long , long long >
#define len(s) (long long)(s.size())
#define all(x) x.begin() , x.end()
#define pofik continue
#define int long long
#define pb push_back
#define F first
#define S second
const int N = 5e5 + 77 , inf = 1e18 + 77;
void solve(){
int n , k;
cin >> n >> k;
int x[n + 5] , y[n + 5];
for(int i = 1; i <= n; i++){
cin >> x[i] >> y[i];
}
if(n <= 1000){
vector < int > v;
for(int i = 1; i <= n; i++){
for(int j = i + 1; j <= n; j++) v.pb(abs(x[i] - x[j]) + abs(y[i] - y[j]));
}
sort(all(v));
for(int i = 0; i < k; i++){
cout << v[i] << '\n';
}
return;
}
}
signed main(){
Respaabs1equal2xdoner
int T = 1;
// cin >> T;
while(T--){
solve();
}
}
# | 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... |