# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
352403 | arnold518 | Kosta (COI14_kosta) | C++14 | 57 ms | 4720 KiB |
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;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define x first
#define y second
const int MAXN = 2e5;
const int INF = 2e9;
int N, K;
pii A[MAXN+10];
int main()
{
scanf("%d%d", &K, &N);
for(int i=1; i<=N; i++)
{
scanf("%d%d", &A[i].x, &A[i].y);
int x2=A[i].x+A[i].y;
int y2=A[i].x-A[i].y;
A[i]={x2, y2};
}
if(K==1)
{
int xl, xr, yl, yr;
xl=INF; xr=-INF; yl=INF; yr=-INF;
for(int i=1; i<=N; i++)
{
xl=min(xl, A[i].x);
xr=max(xr, A[i].x);
yl=min(yl, A[i].y);
yr=max(yr, A[i].y);
}
int D=INF, ans=-1;
for(int i=1; i<=N; i++)
{
int t=max({xr-A[i].x, A[i].x-xl, yr-A[i].y, A[i].y-yl});
if(D>=t) D=t, ans=i;
}
printf("%d\n%d\n", D, ans);
}
}
Compilation message (stderr)
# | 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... |
# | 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... |