제출 #701125

#제출 시각아이디문제언어결과실행 시간메모리
701125minhcoolRoad Construction (JOI21_road_construction)C++17
5 / 100
3630 ms2097152 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

const int N = 3e5 + 5;

const int oo = 1e18 + 7, mod = 1e9 + 7;

int n, k;
ii a[N];

priority_queue<int, vector<int>, greater<int>> pq;

void process(){
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j <= n; j++){
			pq.push({abs(a[i].fi - a[j].fi) + abs(a[i].se - a[j].se)});
			//if(pq.size() > k) pq.pop();
		}
	}
	for(int i = 1; i <= k; i++){
		cout << pq.top() << "\n";
		pq.pop();
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	process();
}
#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...