MaximTakkaTo

task3

Jan 20th, 2021
590
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. q = int(input())
  2. s = input()
  3. a = s.split(" ")
  4. a = [int(x) for x in a]
  5. b = [0] * q
  6. i = 0
  7. while i < len(a):
  8.     if a[i] % 2 == 0 and (i + 1) % 2 != 0:
  9.         b[i] = 1
  10.     elif a[i] % 2 != 0 and (i + 1) % 2 == 0:
  11.         b[i] = 2
  12.     i += 1
  13. chetn = -1
  14. nechetn = -1
  15. i = 0
  16. while i < len(b):
  17.     if b[i] == 1:    
  18.         if chetn == -1:
  19.             chetn = i
  20.         else:
  21.             chetn = -1
  22.             break
  23.     if b[i] == 2:
  24.         if nechetn == -1:
  25.             nechetn = i
  26.         else:
  27.             nechetn = -1
  28.             break
  29.     i += 1
  30. if chetn != -1 and nechetn != -1:
  31.     print(chetn + 1, nechetn + 1)
  32. else:
  33.     print(-1, -1)
RAW Paste Data