/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 20ms 2.938 MiB
#2 Accepted 20ms 3.016 MiB
#3 Accepted 21ms 3.113 MiB
#4 Accepted 22ms 3.062 MiB
#5 Accepted 21ms 3.07 MiB
#6 Accepted 21ms 3.027 MiB
#7 Accepted 21ms 3.027 MiB
#8 Accepted 21ms 3.062 MiB
#9 Time Exceeded ≥2079ms ≥12.223 MiB
#10 Time Exceeded ≥2096ms ≥12.098 MiB

Code

#Nafi_62_i

n = int(input())
lst = list(map(int,input().split()))
odd = []
even = []
odd_len = 0
for i in lst:
    if i % 2 == 0:
        if odd_len == 0:
            even.append(i)
    else:
        odd.append(i)
        odd_len += 1
        jug = sum(odd)
        if jug % 2 == 0:
            odd_len = 0
            even.append(jug)
        else:
            continue
if odd_len == 0:
    ans = len(even)
else:
    ans = -1
print(ans)

Information

Submit By
Type
Submission
Problem
P1042 Array partition
Language
Python 3 (Python 3.12.3)
Submit At
2024-04-02 18:04:13
Judged At
2024-11-11 03:36:25
Judged By
Score
45
Total Time
≥2096ms
Peak Memory
≥12.223 MiB