Submission #502488

# Submission time Handle Problem Language Result Execution time Memory
502488 2022-01-06T06:12:00 Z tmn2005 Odd-even (IZhO11_oddeven) Python 3
100 / 100
20 ms 2836 KB
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
1 Correct 20 ms 2796 KB Output is correct
2 Correct 15 ms 2836 KB Output is correct
3 Correct 18 ms 2720 KB Output is correct
4 Correct 13 ms 2816 KB Output is correct
5 Correct 15 ms 2824 KB Output is correct
6 Correct 15 ms 2820 KB Output is correct
7 Correct 13 ms 2816 KB Output is correct
8 Correct 14 ms 2820 KB Output is correct
9 Correct 16 ms 2828 KB Output is correct
10 Correct 16 ms 2764 KB Output is correct
11 Correct 13 ms 2820 KB Output is correct
12 Correct 12 ms 2816 KB Output is correct
13 Correct 12 ms 2764 KB Output is correct
14 Correct 13 ms 2812 KB Output is correct
15 Correct 13 ms 2784 KB Output is correct
16 Correct 14 ms 2764 KB Output is correct
17 Correct 14 ms 2824 KB Output is correct
18 Correct 14 ms 2812 KB Output is correct
19 Correct 14 ms 2804 KB Output is correct
20 Correct 14 ms 2764 KB Output is correct
21 Correct 19 ms 2780 KB Output is correct
22 Correct 14 ms 2816 KB Output is correct