/ 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> ValueError: invalid literal for int() with base 10: '1 3\r' 12ms 2.777 MiB
#2 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> ValueError: invalid literal for int() with base 10: '7 4 \r' 12ms 2.672 MiB
#3 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> ValueError: invalid literal for int() with base 10: '7 4 0 9 4 8 8 2 4 5 5 1 7 1 1 5 2 7 6 1 4 2 3 2 2 1 6 8 5 7 6 1 8 9 2 7 9 5 4 3 1 2 \r' 12ms 2.828 MiB
#4 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> ValueError: invalid literal for int() with base 10: '1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 0 1 0 1 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1 1 0 \r' 11ms 2.727 MiB
#5 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> ValueError: invalid literal for int() with base 10: '2 0 0 2 0 0 0 0 0 2 2 2 2 2 2 2 0 2 0 2 0 0 2 0 0 2 0 0 2 2 0 2 0 2 0 2 2 2 0 2 2 0 \r' 11ms 2.883 MiB
#6 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> ValueError: invalid literal for int() with base 10: '41 67 34 0 69 24 78 58 62 64 5 45 81 27 61 91 95 42 27 36 91 4 2 53 92 82 21 16 18 95 47 26 71 38 69 12 67 99 35 94 3 11 22 33 73 64 41 11 53 68 47 44 62 57 37 59 23 41 29 78 16 35 90 42 88 6 40 42 6 12ms 2.949 MiB
#7 Runtime Error Traceback (most recent call last): File "foo.py", line 8, in <module> ValueError: invalid literal for int() with base 10: '1 1\r' 11ms 2.914 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
P1013 Divisible by 3
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-06 13:43:04
Judged At
2024-01-06 13:43:04
Judged By
Score
0
Total Time
12ms
Peak Memory
2.949 MiB