/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 19ms 2.777 MiB
#2 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 24ms 2.875 MiB
#3 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 21ms 2.793 MiB
#4 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 22ms 2.734 MiB
#5 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 99ms 2.875 MiB
#6 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 33ms 2.781 MiB
#7 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 141ms 2.879 MiB
#8 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 144ms 2.879 MiB

Code

t=int(input())
for i in range(t):
    n=int(input())
    sum = 0;
    rem_1 = 0 
    rem_2 = 0
    for z in range(n):
        x = int(input())
        sum += x
        if x % 3 == 1:
            rem_1 += 1
        if x % 3 == 2:
            rem_2 += 1


    if sum % 3 == 0:
            print(n, end='')
    elif sum % 3 == 1:
        if rem_1 >= 1:
            print(n - 1, end='')
        else:
            print(n - 2,end='')
    elif sum % 3 == 2:
        if rem_2 >= 1 :
            print(n - 1,end='')
        else:
            print(n - 2,end='')

Information

Submit By
Type
Submission
Problem
P1009 XOR Love
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-06 13:34:45
Judged At
2024-01-06 13:34:45
Judged By
Score
0
Total Time
144ms
Peak Memory
2.879 MiB