# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019654 | Minbaev | Odd-even (IZhO11_oddeven) | Pypy 3 | 46 ms | 20148 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 = 1
r = 1e51
ans = -1
while l <= r:
mid = (l + r) // 2
sum = mid * (mid + 1) // 2
if sum >= n:
ans = mid
r = mid - 1
else:
l = mid + 1
# Correct calculation for 'val'
val = (ans * (ans + 1) // 2 - n) * 2 + (ans - 1)
print(val)
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |