Accepted
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
- Pretest
- Problem
- P1009 XOR Love
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-01-06 13:57:36
- Judged At
- 2025-02-09 14:04:46
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes