Submission #1019655

# Submission time Handle Problem Language Result Execution time Memory
1019655 2024-07-11T06:37:20 Z Minbaev Odd-even (IZhO11_oddeven) PyPy
0 / 100
21 ms 19264 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

Sorry: IndentationError: unexpected indent (oddeven.py, line 1)
# Verdict Execution time Memory Grader output
1 Runtime error 21 ms 19264 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -