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>
using namespace std;
long long n,k,x[10001],y[10001],a[10000001],s;
int main()
{
cin >> n >> k;
for (int i=1; i<=n; i++){
cin >> x[i] >> y[i];
}
for (int i=1; i<=n-1; i++){
for (int j=i+1; j<=n; j++){
a[s]= abs(x[i]-x[j])+abs(y[i]-y[j]); s++;
}
}
sort(a,a+s);
for (int i=0; i<k; i++){
cout<<a[i]<<endl;
}
}
# | 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... |