This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |