Submission #882221

# Submission time Handle Problem Language Result Execution time Memory
882221 2023-12-02T19:50:25 Z Mr_Husanboy Odd-even (IZhO11_oddeven) Python 3
100 / 100
13 ms 2928 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 - 1) // 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 Correct 10 ms 2908 KB Output is correct
2 Correct 11 ms 2908 KB Output is correct
3 Correct 10 ms 2768 KB Output is correct
4 Correct 10 ms 2908 KB Output is correct
5 Correct 10 ms 2868 KB Output is correct
6 Correct 10 ms 2908 KB Output is correct
7 Correct 10 ms 2908 KB Output is correct
8 Correct 10 ms 2908 KB Output is correct
9 Correct 10 ms 2812 KB Output is correct
10 Correct 13 ms 2896 KB Output is correct
11 Correct 11 ms 2908 KB Output is correct
12 Correct 13 ms 2888 KB Output is correct
13 Correct 10 ms 2908 KB Output is correct
14 Correct 10 ms 2908 KB Output is correct
15 Correct 10 ms 2812 KB Output is correct
16 Correct 10 ms 2908 KB Output is correct
17 Correct 10 ms 2908 KB Output is correct
18 Correct 10 ms 2908 KB Output is correct
19 Correct 10 ms 2908 KB Output is correct
20 Correct 11 ms 2908 KB Output is correct
21 Correct 10 ms 2928 KB Output is correct
22 Correct 10 ms 2908 KB Output is correct