Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

petr_qwerty's blog

By petr_qwerty, history, 16 hours ago, In Russian

t=int(input()) cm=[] sk=[] ttm=[-11111111111111111] cr=[-10000000000000000] for i in range(t): a=int(input()) if(a>=0 and a%2==0): cm.append(a) elif(a>=0 and a%2!=0): sk.append(a) elif(a<=0 and a%2==0):

ttm.append(a)
elif(a<=0 and a%2!=0):
    cr.append(a)

if(len(cm)==0): cm.append(0) if(len(sk)==0): sk.append(0) print(max(sum(cm)-min(cm),sum(cm)+max(ttm))+max(sum(sk)-min(sk),sum(sk)+max(cr)))

  • Vote: I like it
  • 0
  • Vote: I do not like it