# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1149566 | Perl32 | Road Construction (JOI21_road_construction) | C++17 | 0 ms | 0 KiB |
//I wrote this code 4 u <3
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
signed main(int32_t argc, char *argv[]) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll n, k;
cin >> n >> k;
vector<pair<ll, ll>> a(n);
for (auto& [x, y] : a) cin >> x >> y;
vector<ll> srt;
auto dst = [&](ll i, ll j) {
return abs(a[i].first - a[j].first) + abs(a[i].second - a[j].second);
};
for (ll i = 0; i < n; ++i) {
for (ll j = i + 1; j < n; ++j) {
srt.push_back(dst(i, j));
}
}
ranges::sort(srt);
for (ll i = 0; i < k; ++i) cout << srt[i] << '\n';
}
/*
*/