#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 |
1 |
Correct |
55 ms |
7092 KB |
Output is correct |
2 |
Correct |
55 ms |
6936 KB |
Output is correct |
3 |
Correct |
35 ms |
5308 KB |
Output is correct |
4 |
Correct |
36 ms |
5052 KB |
Output is correct |
5 |
Correct |
51 ms |
5776 KB |
Output is correct |
6 |
Correct |
18 ms |
6348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1285 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1171 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1171 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
7092 KB |
Output is correct |
2 |
Correct |
55 ms |
6936 KB |
Output is correct |
3 |
Correct |
35 ms |
5308 KB |
Output is correct |
4 |
Correct |
36 ms |
5052 KB |
Output is correct |
5 |
Correct |
51 ms |
5776 KB |
Output is correct |
6 |
Correct |
18 ms |
6348 KB |
Output is correct |
7 |
Runtime error |
1111 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
7092 KB |
Output is correct |
2 |
Correct |
55 ms |
6936 KB |
Output is correct |
3 |
Correct |
35 ms |
5308 KB |
Output is correct |
4 |
Correct |
36 ms |
5052 KB |
Output is correct |
5 |
Correct |
51 ms |
5776 KB |
Output is correct |
6 |
Correct |
18 ms |
6348 KB |
Output is correct |
7 |
Runtime error |
1285 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |