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;
typedef long long ll;
#define f(i,a,b) for(int i = a; i < b; i++)
const int N = 1e5 + 5;
const ll inf = 2e18;
int n;
ll a[N], b[N];
int main(){
cin >> n;
f(i,1,n+1) cin >> a[i] >> b[i];
ll ans = inf, x, y;
f(i,1,n+1){
f(j,1,n+1){
ll res = 0;
f(k,1,n+1){
res += abs(a[k]-a[i]) + abs(b[k]-b[j]);
}
if(res < ans){
x = a[i], y = b[j];
ans = res;
}
}
}
cout << x << " " << y << "\n";
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... |