/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 16ms 3.062 MiB
#2 Accepted 16ms 3.039 MiB
#3 Accepted 16ms 3.125 MiB
#4 Accepted 15ms 3.008 MiB
#5 Accepted 15ms 3.129 MiB
#6 Accepted 15ms 3.113 MiB
#7 Accepted 15ms 3.125 MiB
#8 Accepted 15ms 3.105 MiB
#9 Wrong Answer 80ms 12.207 MiB
#10 Accepted 56ms 12.32 MiB
#11 Wrong Answer 81ms 12.262 MiB

Code

n = int(input())
x = list(map(int, input().split()))
count = 0
odd = 0

for i in range(n):
    if x[i] % 2 != 0:
        odd += 1
if odd % 2 != 0:
    print(-1)
else:
    for i in range(n):
        if x[i] % 2 == 0:
            count += 1
        else:
            odd += 1
            if odd % 2 == 0:
                count += 1
    print(count)

Information

Submit By
Type
Submission
Problem
P1042 Array partition
Contest
TLE_Headquarters - round #1
Language
Python 3 (Python 3.12.3)
Submit At
2024-03-27 17:06:59
Judged At
2024-11-11 03:37:44
Judged By
Score
50
Total Time
81ms
Peak Memory
12.32 MiB