#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb emplace_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) (ll)x.size()
#define ALL(x) x.begin(),x.end()
#define lb lower_bound
#define ub upper_bound
const ll MAXN=250100;
const ll MAXK=19;
ll N,K,a,b;
vpi V;
vector<pair<pi,int>> A;
vpi ans;
ll W;
ll d(int a,int b){
return abs(V[a].f-V[b].f) + abs(V[a].s-V[b].s);
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>N>>K;
for(ll i=0;i<N;++i){
cin>>a>>b;
V.pb(a,b);
A.pb(mp(b-a,b+a),i);
}
vi ans;
for(int i=0;i<N;++i)for(int j=i+1;j<N;++j){
ans.pb(d(i,j));
}
sort(ALL(ans));
for(int i=0;i<K;++i)cout<<ans[i]<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
6968 KB |
Output is correct |
2 |
Correct |
77 ms |
6984 KB |
Output is correct |
3 |
Correct |
50 ms |
5040 KB |
Output is correct |
4 |
Correct |
51 ms |
5084 KB |
Output is correct |
5 |
Correct |
71 ms |
5824 KB |
Output is correct |
6 |
Correct |
25 ms |
4612 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2181 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2000 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2000 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
6968 KB |
Output is correct |
2 |
Correct |
77 ms |
6984 KB |
Output is correct |
3 |
Correct |
50 ms |
5040 KB |
Output is correct |
4 |
Correct |
51 ms |
5084 KB |
Output is correct |
5 |
Correct |
71 ms |
5824 KB |
Output is correct |
6 |
Correct |
25 ms |
4612 KB |
Output is correct |
7 |
Runtime error |
1925 ms |
2097156 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
89 ms |
6968 KB |
Output is correct |
2 |
Correct |
77 ms |
6984 KB |
Output is correct |
3 |
Correct |
50 ms |
5040 KB |
Output is correct |
4 |
Correct |
51 ms |
5084 KB |
Output is correct |
5 |
Correct |
71 ms |
5824 KB |
Output is correct |
6 |
Correct |
25 ms |
4612 KB |
Output is correct |
7 |
Runtime error |
2181 ms |
2097156 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |