20250129

I’m very sleepy… what’s going on in my body!?

2061A. Kevin and Arithmetic - 800

# resulting s[i] is even -> (s[i - 1] is even and ai is even) or (s[i - 1] is odd and ai is odd)
# The first condition can be met only once s[0] = 0, s[i] (i > 0) is always odd due to divisions
# to max out,
# if even exists -> 1 + len(odds)
# else -> len(odds) - 1 (to create the first odd sum)


for _ in range(int(input())):
    n: int = int(input())
    a: list[int] = list(map(int, input().split()))
    evens: list[int] = [x for x in a if x % 2 == 0]
    odds: list[int] = [x for x in a if x % 2 == 1]
    if evens:
        print(1 + len(odds))
    else:
        print(len(odds) - 1)

TODO:


index 20250128 20250130