/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 19ms 2.922 MiB
#2 Wrong Answer 20ms 3.133 MiB
#3 Accepted 23ms 3.141 MiB
#4 Wrong Answer 21ms 3.156 MiB

Code

for _ in range(int(input())):
    n = int(input())
    l = list(map(int, input().split()))
    
    summ = sum(l)
    if sum(l)%3 == 0:
        print(n)
    else:
        rem = summ%3
        if rem == 1:
            if 1 in l:
                l.remove(1)
                print(n - 1)
            elif 2 in l:
                l.remove(2)
                print(n - 1)
            else:
                print(0)
        
        elif rem == 2:
            if 2 in l:
                l.remove(2)
                print(n - 1)
            elif 1 in l:
                l.remove(1)
                print(n - 1)
            else:
                print(0)

     

Information

Submit By
Type
Submission
Problem
P1013 Divisible by 3
Contest
Brain booster - 1
Language
Python 3 (Python 3.12.3)
Submit At
2023-12-31 14:36:37
Judged At
2024-11-11 03:46:14
Judged By
Score
30
Total Time
23ms
Peak Memory
3.156 MiB