max за ceil(n / 2)

Revision ru1, by Tih_Monkes, 2024-02-10 11:55:55

a = list(map(int, input().split())) l, r = 0, len(a) — 1 while(r — l >= 1): if(a[l] > a[l + 1]): a[l + 1], a[l] = a[l], a[l + 1] if(a[r] > a[r — 1]): a[r — 1], a[r] = a[r], a[r — 1] l += 1 r -= 1 print(max(a[l], a[r]))

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru1 Russian Tih_Monkes 2024-02-10 11:55:55 309 Первая редакция (опубликовано)