# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
502488 | tmn2005 | Odd-even (IZhO11_oddeven) | Cpython 3 | 20 ms | 2836 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.
n = int(input())
l = 0
r = n;
while l + 1 < r:
m = (l + r) // 2;
if(m * (m + 1) // 2 <= n):
l = m
else:
r = m
tl = (l * (l + 1) // 2 + (l-1) * (l) // 2)
k = n - l * (l + 1) // 2
tm = (tl + k + (k - 1))
print(tm)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |