Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/tasks/water-collected-between-towers/oracle.py # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / tasks / water-collected-between-towers / oracle.py` 10 lines ยท 675 bytes Raw Blame History 1 # Independent reference for "Water collected between towers" (Python 3, standard library only). 2 # expected.txt is this program's stdout; omc never produced it. 3 for towers in [[1, 5, 3, 7, 2], [5, 3, 7, 2, 6, 4, 5, 9, 1, 2], [2, 6, 3, 5, 2, 8, 1, 4, 2, 2, 5, 3, 5, 7, 4, 1], [5, 5, 5, 5], [5, 6, 7, 8], [8, 7, 7, 6], [6, 7, 10, 7, 6]]: 4 print(*towers) 5 # fill level by level: at height h, count the empty cells strictly between the outermost towers >= h 6 water = 0 7 for h in range(1, max(towers) + 1): 8 idx = [i for i, t in enumerate(towers) if t >= h] 9 water += sum(1 for i in range(idx[0], idx[-1] + 1) if towers[i] < h) 10 print("water:", water)