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 int long long
#define fastio ios::sync_with_stdio(0), cin.tie(0);
using namespace std;
const int MAX_N = 5e5+10;
const int INF = 2e18;
int n, m;
int a, b;
vector<pair<int, int>> v;
vector<int> p;
void solve1(){
// input
cin >> n >> m;
for (int i=0 ; i<n ; i++){
cin >> a >> b;
v.push_back({a, b});
}
// process
for (int i=0 ; i<n ; i++){
for (int j=i+1 ; j<n ; j++){
p.push_back(abs(v[i].first-v[j].first)+abs(v[i].second-v[j].second));
}
}
sort(p.begin(), p.end());
// output
for (int i=0 ; i<m ; i++){
cout << p[i] << "\n";
}
return;
}
signed main(){
fastio;
int t = 1;
while (t--){
solve1();
}
return 0;
}
# | 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... |