Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [q] sQ
- # Score priority, reset and quit to main loop
- [
- r l2+ s2
- c 0Sc 3Q
- ] sP
- # Increment c(pri)
- [
- d;c 1+ # c(pri)+1 pri rest
- d 3=P # score if sum == 3
- r:c # c(pri) = c(pri)+1
- 0 # push value to be discarded
- ] sI
- # Loop (stack: items)
- [
- 32~ r 3- 26*- # convert item to priority
- d;c ls =I s. # inc c(pri) == state, discard pri
- z 0<L # loop until stack empty
- ] sL
- # Main loop
- [
- ?z 0=Q # get line, quit if empty
- lLx # parse line into count array
- ls 1+ 3% ss # inc state (mod 3)
- lMx
- ] sM
- lMx
- [Part 2: ]n l2p
- [<END>]ps.
- [<stack>]ps. f [<bottom>]ps.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement