/ 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 18ms 2.762 MiB
#2 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 24ms 2.844 MiB
#3 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 20ms 2.648 MiB
#4 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 22ms 2.789 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.879 MiB
#7 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 139ms 2.875 MiB
#8 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> EOFError: EOF when reading a line 146ms 2.879 MiB

Code

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


    if summation % 3 == 0:
            print(n)
            print()
    elif summation % 3 == 1:
        if rem_1 >= 1:
            print(n - 1)
            print()
        else:
            print(n - 2)
            print()
    elif summation % 3 == 2:
        if rem_2 >= 1 :
            print(n - 1)
            print()
        else:
            print(n - 2)
            print()

Information

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