ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1296. Hyperjump

WA7 can't find my mistake python
Posted by mahachkala wins 28 Oct 2024 07:07
N = int(input())
p = []
maxi = 0

for i in range(N):
    p.append(int(input()))

summi = sum(p)
for i in range(N):
  fsummi = sum(p[i:len(p)-i-1])
  if fsummi > maxi and fsummi>summi :
      maxi = fsummi

maxi2 = 0
for i in range(0, N-1):
  nsummi = sum(p[i::])
  jsummi=summi-nsummi
  if nsummi > jsummi:
    maxi2 = nsummi
  else:
    maxi2 = jsummi

if maxi>maxi2:
  print(maxi)
elif summi> maxi and summi>maxi2:
  print(summi)
else:
  print(maxi2)