omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / tasks / sort-disjoint-sublist / oracle.py
| 1 | # Independent reference for "Sort disjoint sublist" (Python 3, standard library only). |
| 2 | # expected.txt is this program's stdout; omc never produced it. |
| 3 | values = [7, 6, 5, 4, 3, 2, 1, 0] |
| 4 | indices = [6, 1, 7] |
| 5 | print(*values) |
| 6 | print("indices:", *indices) |
| 7 | ix = sorted(set(indices)) |
| 8 | for i, v in zip(ix, sorted(values[i] for i in ix)): |
| 9 | values[i] = v |
| 10 | print(*values) |