Submission #945835

#TimeUsernameProblemLanguageResultExecution timeMemory
945835thelegendary08Road Construction (JOI21_road_construction)C++14
5 / 100
1285 ms2097152 KiB
#include<bits/stdc++.h> #define vi vector<int> #define vll vector<long long int> #define vpii vector<pair<int,int>> #define vpll vector<pair<long long int, long long int>> #define pb push_back #define f0r(i,n) for(int i = 0;i<n;i++) using namespace std; typedef long long int ll; const int mod = 1e9 + 7; const int mxn = 1e5 + 5; int main(){ ll n,k; cin>>n>>k; vpll v; f0r(i,n){ ll x,y; cin>>x>>y; v.pb({x,y}); } vll lengths; f0r(i,n-1){ for(int j = i+1;j<n;j++){ if(i != j){ lengths.pb(abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second)); } } } sort(lengths.begin(), lengths.end()); //for(auto u : lengths)cout<<u<<' '; //cout<<'\n'; f0r(i,k)cout<<lengths[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...