# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1109848 | Raj | Circle Passing (EGOI24_circlepassing) | C++11 | 433 ms | 52560 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;
int n,M,Q;
set <int> s;
int dist(int x,int y)
{
return min(abs(x-y),n*2-abs(x-y));
}
int shc(int x, int y)
{
auto it=s.lower_bound(x);
if(it==s.end())
it=s.begin();
int val=*it;
if(val>n)
val-=n;
else
val+=n;
int ans=min(dist(x,y),dist(x,*it)+1+dist(val,y));
if(it==s.begin())
it=prev(s.end());
else
it=prev(it);
val=*it;
if(val>n)
val-=n;
else
val+=n;
ans=min(ans,dist(x,*it)+1+dist(val,y));
return ans;
# | 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... |