chiark
/
gitweb
/
~bjharris
/
aoc-2022.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
21e6051
)
19a even faster
author
Ben Harris
<bjh21@bjh21.me.uk>
Tue, 28 May 2024 08:26:34 +0000
(09:26 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Tue, 28 May 2024 08:26:34 +0000
(09:26 +0100)
Merging the two "is it worth it?" checks.
19/19a.bqn
patch
|
blob
|
history
diff --git
a/19/19a.bqn
b/19/19a.bqn
index d7f05cb0858b1129b794592313703c8b68aeb776..4a60aa3cca6656d12a2b460a3338bc58d88b92c6 100644
(file)
--- a/
19/19a.bqn
+++ b/
19/19a.bqn
@@
-28,7
+28,7
@@
EvalBlueprint←{𝕊 robot_costs:
needed←(𝕩⊏robot_costs)-stock
needed_time←1+0⌈⌈´⌈NtZ needed÷robots
# Build a robot if there's time and we might need it.
- (needed_time≤time)∧(𝕩⊑
stock<max_costs×time)∧(𝕩⊑robots<max_costs
) ?
+ (needed_time≤time)∧(𝕩⊑
(stock+robots×time)<max_costs×time
) ?
Search ⟨time-needed_time
(stock+robots×needed_time)-𝕩⊏robot_costs
(1⊸+)⌾(𝕩⊸⊑)robots⟩;