# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338453 | 2020-12-23T07:19:50 Z | amunduzbaev | Odd-even (IZhO11_oddeven) | Python 3 | 16 ms | 2816 KB |
import math x = int(input()) l = 1 r = int(math.sqrt(x))+1 while (l < r): m = (l + r)//2 if((m*(m+1)//2) > x): r = m-1 elif(((m+1)*(m+2)//2) < x): l = m+1 else: break ans = (l + r)//2 need = x - ans*(ans+1)//2 if(need == 0): aa = ans * ans else : aa = ans * ans+1 +((need-1)*2) print(aa)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 2816 KB | Output is correct |
2 | Correct | 16 ms | 2796 KB | Output is correct |
3 | Incorrect | 16 ms | 2796 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |