| Task: | Lukujono |
| Sender: | rottis |
| Submission time: | 2025-10-31 01:04:40 +0200 |
| Language: | text |
| Status: | READY |
| Result: | 46 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 46 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | 46 | details |
Code
# Q = 114
# 458 successful iterations
INCREASE Q INCREASE Q INCREASE Q INCREASE Q # 4^3 * 2 = 128
#CLEAR S # s <= (x > 0) assume empty
#CLEAR L assume empty
#CLEAR M assume empty
INCREASE M
REPEAT X TIMES (
REPEAT M TIMES ( REPEAT L TIMES ( CLEAR M INCREASE S ) INCREASE L )
)
PRINT X
REPEAT Q TIMES (
REPEAT S TIMES ( # skips iterations a lot faster if there are a lot to skip
REPEAT Q TIMES (
REPEAT S TIMES (
REPEAT Q TIMES ( # repeat 11 times 11 times: 121 times
# if x > 1
REPEAT S TIMES (
# o: store x / 2
CLEAR O
# a: even
# b: odd
# c: pass-through
INCREASE A
#CLEAR C always clear, used as pass-through
REPEAT X TIMES (
# flip-flop a/b
REPEAT A TIMES ( CLEAR A INCREASE C )
REPEAT B TIMES ( CLEAR B INCREASE A INCREASE O )
REPEAT C TIMES ( CLEAR C INCREASE B )
)
# if a
REPEAT A TIMES (
CLEAR A
# o is already 0.5x!
# check only needed in this branch!
# other branch always increases value of x
# check x/2 > 1 (for next iteration)
CLEAR S # s <= (x > 0)
CLEAR L # L is set to 2 after the loop, cannot assume empty
#CLEAR M assume empty, if not empty then we shouldnt be inside the loop
# Better x > 1 alg!
INCREASE M
REPEAT O TIMES (
REPEAT M TIMES ( REPEAT L TIMES ( CLEAR M INCREASE S ) INCREASE L )
)
)
# else (if b)
REPEAT B TIMES (
CLEAR B
# x += 4o
# o += 2o
REPEAT O TIMES ( INCREASE X INCREASE X INCREASE X INCREASE X INCREASE O INCREASE O )
# o = 3o+4
INCREASE X INCREASE X INCREASE X
# x += 1
INCREASE O
# o += 1
INCREASE O
# print o: 3x+1
PRINT X
)
# mandatory print
PRINT O
)
# swapped variable version
# if x > 1
REPEAT S TIMES (
# o: store x / 2
CLEAR X
# a: even
# b: odd
# c: pass-through
INCREASE A
#CLEAR C always clear, used as pass-through
REPEAT O TIMES (
# flip-flop a/b
REPEAT A TIMES ( CLEAR A INCREASE C )
REPEAT B TIMES ( CLEAR B INCREASE A INCREASE X )
REPEAT C TIMES ( CLEAR C INCREASE B )
)
# if a
REPEAT A TIMES (
CLEAR A
# x is already 0.5o!
# check only needed in this branch!
# other branch always increases value of x
# check x/2 > 1 (for next iteration)
CLEAR S # s <= (x > 0)
CLEAR L # L is set to 2 after the loop, cannot assume empty
#CLEAR M assume empty, if not empty then we shouldnt be inside the loop
# Better x > 1 alg!
INCREASE M
REPEAT X TIMES (
REPEAT M TIMES ( REPEAT L TIMES ( CLEAR M INCREASE S ) INCREASE L )
)
)
# else (if b)
REPEAT B TIMES (
CLEAR B
REPEAT X TIMES ( INCREASE O INCREASE O INCREASE O INCREASE O INCREASE X INCREASE X )
INCREASE O INCREASE O INCREASE O
INCREASE X INCREASE X
PRINT O
)
# mandatory print
PRINT X
)
)
)
)
)
)
