Submission details
Task:Lukujono
Sender:Wiita
Submission time:2025-11-06 19:22:43 +0200
Language:text
Status:READY
Result:53
Feedback
groupverdictscore
#1ACCEPTED53
Test results
testverdicttimescore
#1ACCEPTED0.00 s53details

Code

# I = 89 (178 / 2)
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I
INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I INCREASE I



REPEAT I TIMES ( 

    # Set Q to 1 to enable calculating
    CLEAR Q
    INCREASE Q


    REPEAT P TIMES ( CLEAR Q )

    # Stop calculating if Q = 0
    REPEAT Q TIMES ( 

        PRINT X


        # Clear variables for calculation
        CLEAR A
        CLEAR T
        CLEAR C
        CLEAR Z


        # Parity check loop determines if X is even or odd
        # After X iterations:
        #   A = 1 if X is odd, 0 if even
        #   T = A (Helper variable)
        #   C = X // 2
        REPEAT X TIMES ( 
        
            INCREASE T

            # Increase C if A = 1 and set T to 0
            REPEAT A TIMES ( 
                CLEAR T
                CLEAR A
                INCREASE C
            )

            # Increase A if T = 1
            REPEAT T TIMES ( 
                INCREASE A 
            )
        )


        # Only check if X = 1 if X is odd
        CLEAR E
        REPEAT A TIMES (
            INCREASE E

            REPEAT C TIMES ( CLEAR E ) # If X = 1, C = 0 so E = 1 | If X > 1, C > 0 so E = 0

            REPEAT E TIMES ( INCREASE P ) # If X = 1, set P = 1 to stop future calculation
        )



        # Decide whether to update X: Q = 1 unless X = 1
        CLEAR Q
        INCREASE Q

        REPEAT E TIMES ( CLEAR Q ) # Decide whether to update X: Q = 1 unless X = 1

        # if Q = 1 update X to next Collatz number
        REPEAT Q TIMES ( 
            CLEAR B
            INCREASE B

            # odd X: 3 * X + 1
            REPEAT A TIMES ( 
                REPEAT X TIMES 
                (
                    INCREASE C
                    INCREASE X
                    INCREASE X
                )
                INCREASE X
                INCREASE C


                PRINT X
                CLEAR B
            )
        )


        #___________________

        REPEAT Q TIMES (
        
        PRINT C 

        # Clear variables for calculation
        CLEAR A
        CLEAR T
        CLEAR X
        CLEAR Z


        # Parity check loop determines if X is even or odd
        # After X iterations:
        #   A = 1 if X is odd, 0 if even
        #   T = A (Helper variable)
        #   X = C // 2
        REPEAT C TIMES ( 
        
            INCREASE T

            # Increase X if A = 1 and set T to 0
            REPEAT A TIMES ( 
                CLEAR T
                CLEAR A
                INCREASE X
            )

            # Increase A if T = 1
            REPEAT T TIMES ( 
                INCREASE A 
            )
        )



        # Check if C = 1, E = 1 
        CLEAR E
        # Only check if C = 1 if C is odd
        REPEAT A TIMES (
            INCREASE E

            REPEAT X TIMES ( CLEAR E ) # For C = 1, X = 0 so E = 1 | for C > 1, X > 0 so E = 0

            REPEAT E TIMES ( INCREASE P ) # If C = 1, set P = 1 to stop future calculation
        )


        # Decide whether to update X: Q = 1 unless C = 1
        CLEAR Q
        INCREASE Q

        REPEAT E TIMES ( CLEAR Q ) # Decide whether to update X: Q = 1 unless C = 1

        # if Q = 1 update C to next Collatz number
        REPEAT Q TIMES ( 
            CLEAR B
            INCREASE B
            # odd C: 3 * C + 1
            REPEAT A TIMES ( 
                REPEAT C TIMES 
                (
                    INCREASE X
                    INCREASE C
                    INCREASE C
                )
                INCREASE C
                INCREASE X

                PRINT C
                CLEAR B
            )    
        )
        )
    )
)

Test details

Test 1 (public)

Verdict: ACCEPTED

input
(empty)

correct output
(empty)

user output
# I = 89 (178 / 2)
INCREASE I INCREASE I INCREASE...

Feedback: 534 tests processed (command limit exceeded)