Submission #882211

# Submission time Handle Problem Language Result Execution time Memory
882211 2023-12-02T19:40:32 Z Mr_Husanboy Odd-even (IZhO11_oddeven) PyPy 3
0 / 100
29 ms 18288 KB
n = int(input())
l = 1
r = 10**50
while l <= r:
    m = (l + r) // 2
    if((m + 1) * m / 2 > n):
        r = m - 1
    else:
        l = m + 1
l -= 1

k = (l + 1) * l // 2

if l % 2 == 1:
    if n == k:
        print(n - l // 2 * 2 - 1)
    else:
        print((n - (l + 1) // 2) * 2)
else:
    if n == k:
        print((n - l // 2) * 2)
    else:
        print((n - l // 2) * 2 - 1)
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 18288 KB Output isn't correct
2 Halted 0 ms 0 KB -