# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333790 | limabeans | Odd-even (IZhO11_oddeven) | Cpython 3 | 16 ms | 2924 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.
def asum(x):
return x*(x+1)//2
def f(i):
return asum(i)
n = int(input())
if n==1:
print(1)
else :
lo = 1
hi = n
while hi-lo>1:
mid = (lo+hi)//2
if f(mid) < n:
lo = mid
else:
hi = mid
i = lo
n -= f(i)
n -= 1 # 0-index
cur = asum(i)+asum(i-1) + 1 + 2*n
print(cur)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |