# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019654 | 2024-07-11T06:36:52 Z | Minbaev | Odd-even (IZhO11_oddeven) | PyPy 3 | 46 ms | 20148 KB |
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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 46 ms | 20148 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |