제출 #1157689

#제출 시각아이디문제언어결과실행 시간메모리
1157689crai0nRoad Construction (JOI21_road_construction)C++20
5 / 100
2227 ms2105820 KiB
/*
	Bismillahir rahmanir rahim
	Allahu akbar
	Alhamdulillah
	Subhanallah
	Rabbi a’inni wa-la tu’in ‘alayya,
	wa-nsurni wa-la tansur ‘alayya,
	wa-mkur-li wa-la tamkur alayya,
	wa-hdini wa-yassir-il-huda ilayya,
	wa-nsurni ‘ala man bagha ‘alayya
	Ya Hayyu Ya Qayyum,
	birahmatika astaghitsu,
	aslih li sha'ni kullahu,
	wa la takilni ila nafsi tarfata ‘aini
*/

#include <bits/stdc++.h>
#define ll long long
#define int long long
#define pb(x) push_back(x)
#define sor(x) sort(x.begin(), x.end())
#define rsor(x) sort(x.rbegin(), x.rend())
#define yes cout << "YES\n";
#define no cout << "NO\n";

#pragma pack(1)

using namespace std;
const int N = 2e5 + 55;
const int MOD = 1e9 + 7;
const bool T = false;

ll bp(ll a, ll n)
{
	if(n == 0)
	{
		return 1;
	}
	if (n & 1)
	{
		return bp(a, n - 1) * a % MOD;
	}
	else
	{
		ll temp = bp(a, n / 2);
		return temp * temp % MOD;
	}
}

void hippopotomonstrosesquipedaliophobia()
{
	ll n, k;
	cin >> n >> k;
	vector<pair<ll, ll>> vc;
	for (int i = 0; i < n; i++)
	{
		ll x, y;
		cin >> x >> y;
		vc.push_back({x, y});
	}
	vector<ll> cost;
	for (int i = 0; i < n; i++){
		for (int j =i + 1; j < n; j++){
			cost.pb(abs(vc[i].first - vc[j].first) + abs(vc[i].second - vc[j].second));
		}
	}
	sor(cost);
	for (int i = 0; i < k; i++)
	{
		cout << cost[i] << '\n';
	}
}

signed main(void)
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int time = 1;
	if (T)
	{
		cin >> time;
	}
	while (time--)
	{
		hippopotomonstrosesquipedaliophobia();
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...