Submission #945928

#TimeUsernameProblemLanguageResultExecution timeMemory
945928WongYiKaiRoad Construction (JOI21_road_construction)C++14
5 / 100
1163 ms2097388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n,k; cin >> n >> k; pair<ll,ll> p[n]; for (int i=0;i<n;i++){ ll x,y; cin >> x >> y; p[i] = {x,y}; } vector<ll> edge; for (int i=0;i<n;i++){ for (int j=i+1;j<n;j++){ edge.push_back(abs(p[i].first-p[j].first)+abs(p[i].second-p[j].second)); } } sort(edge.begin(),edge.end()); for (int i=0;i<k;i++){ cout << edge[i] << "\n"; } }
#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...