Time Exceeded
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