General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
176797421 Practice:
Bandhavi
1709B - 11 Python 3 Accepted 1076 ms 9864 KB 2022-10-17 21:51:34 2022-10-17 21:51:34
→ Source
craft=lambda:map(int,input().split())
n,m=craft()
*an,=craft()
by=[[0],[0]]
for x in by:
 for u,v in zip([0]+an,an):x+=x[-1]+max(0,u-v),
 an=an[::-1]
by[1]=[0]+by[1][::-1]
for _ in[0]*m:s,t=craft();l=by[s>t];print(abs(l[s]-l[t]))
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details