#include <bits/stdc++.h>
#define forf(i,a,b) for(int i = a; i<=b; i++)
#define all(v) v.begin(),v.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
int N,K;
ll X[1000001],Y[1000001];
pair<ll,ll> Xind[1000001] , Yind[100001];
set<pair<ll,ll> > S;
ll inf = 1e18;
ll ab(ll x){ return x<0?-x:x;}
vector<ll> All;
void naive(){
forf(i,1,N){
forf(j,i+1,N){
All.push_back(max(ab(X[i]-X[j]),ab(Y[i]-Y[j])));
}
}
sort(all(All));
forf(i,0,K-1) printf("%lld\n" , All[i]);
}
int main(){
scanf("%d %d" , &N,&K);
forf(i,1,N) scanf("%lld %lld" , &X[i] , &Y[i]);
forf(i,1,N){
ll x = X[i], y = Y[i];
X[i] = x+y;
Y[i] = x-y;
Xind[i] = {X[i],i};
Yind[i] = {Y[i],i};
}
sort(Xind+1,Xind+N+1); sort(Yind+1,Yind+N+1);
naive();
}
Compilation message
road_construction.cpp: In function 'int main()':
road_construction.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
26 | scanf("%d %d" , &N,&K);
| ~~~~~^~~~~~~~~~~~~~~~~
road_construction.cpp:27:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
27 | forf(i,1,N) scanf("%lld %lld" , &X[i] , &Y[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
13304 KB |
Output is correct |
2 |
Correct |
58 ms |
13240 KB |
Output is correct |
3 |
Correct |
40 ms |
11320 KB |
Output is correct |
4 |
Correct |
40 ms |
11196 KB |
Output is correct |
5 |
Correct |
56 ms |
12748 KB |
Output is correct |
6 |
Correct |
19 ms |
12748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2097 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1779 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1779 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
13304 KB |
Output is correct |
2 |
Correct |
58 ms |
13240 KB |
Output is correct |
3 |
Correct |
40 ms |
11320 KB |
Output is correct |
4 |
Correct |
40 ms |
11196 KB |
Output is correct |
5 |
Correct |
56 ms |
12748 KB |
Output is correct |
6 |
Correct |
19 ms |
12748 KB |
Output is correct |
7 |
Runtime error |
1733 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
13304 KB |
Output is correct |
2 |
Correct |
58 ms |
13240 KB |
Output is correct |
3 |
Correct |
40 ms |
11320 KB |
Output is correct |
4 |
Correct |
40 ms |
11196 KB |
Output is correct |
5 |
Correct |
56 ms |
12748 KB |
Output is correct |
6 |
Correct |
19 ms |
12748 KB |
Output is correct |
7 |
Runtime error |
2097 ms |
2097152 KB |
Execution killed with signal 9 |
8 |
Halted |
0 ms |
0 KB |
- |