Submission #1125958

#TimeUsernameProblemLanguageResultExecution timeMemory
1125958Kel_MahmutRoad Construction (JOI21_road_construction)C++20
5 / 100
6825 ms2106048 KiB
#include <bits/stdc++.h> #define pb push_back #define endl ("\n") #define all(aa) aa.begin(), aa.end() typedef long long ll; using namespace std; int main(){ int n, k; cin >> n >> k; vector<pair<ll, ll>> v(n); for(int i = 0; i < n; i++) cin >> v[i].first >> v[i].second; auto calc = [&](pair<ll, ll> a, pair<ll, ll> b){ return abs(a.first - b.first) + abs(a.second - b.second); }; priority_queue<ll, vector<ll>, greater<ll>> pq; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ pq.push(calc(v[i], v[j])); } } for(int i = 0; i < k; i++){ cout << pq.top() << endl; pq.pop(); } }
#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...