Baseline: tree as shared

This commit is contained in:
alexm committed 2026-10-05 03:03:38 +00:00
commit 31f2fb8a5a
1679 files changed
+1024562

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
# origin: Programming+ exercise best-position
# status: unverified; `corpus.py verify` checks it on the pinned compiler
# probe: the position of the highest quality score; the first one, if several tie
# expect-stdout: 1
def best_position(q: List[Int]) -> Int:
# requires: len(q) >= 1
# ensures: 0 <= result < len(q)
# ensures: forall k in [0, len(q)) : q[k] <= q[result]
var best: Int = 0
for i in range(1, len(q)):
# invariant: 0 <= best < i
# invariant: forall k in [0, i) : q[k] <= q[best]
if q[i] > q[best]:
best = i
return best
def main():
var scores: List[Int] = [12, 30, 25, 30, 8]
print(best_position(scores))