/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Runtime Error Traceback (most recent call last): File "foo.py", line 2, in <module> ValueError: invalid literal for int() with base 10: '4 8\r' 14ms 3.078 MiB
#2 Runtime Error Traceback (most recent call last): File "foo.py", line 2, in <module> ValueError: invalid literal for int() with base 10: '997 994009\r' 14ms 2.988 MiB

Code

for _ in range(int(input())):
    n = int(input())
    l = list(map(int, input().split()))

    summ = sum(l)
    if summ % 3 == 0:
        print(n)
    else:
        rem = summ % 3
        reml = []
        if rem == 1:
            if 1 in l:
                reml.append(l.index(1))
            elif 2 in l:
                reml.append(l.index(2))
            else:
                print(0)
                continue
        elif rem == 2:
            if 2 in l:
                reml.append(l.index(2))
            elif 1 in l:
                reml.append(l.index(1))
            else:
                print(0)
                continue

        new = [x for i, x in enumerate(l) if i != reml[0]]
        print(len(new))

Information

Submit By
Type
Submission
Problem
P1011 LCD
Contest
Brain booster - 1
Language
Python 3 (Python 3.12.3)
Submit At
2023-12-31 15:28:41
Judged At
2024-11-11 03:45:40
Judged By
Score
0
Total Time
14ms
Peak Memory
3.078 MiB