?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
166696061 |
Practice: 207r1a05a3 |
1709B - 11 | Python 3 | Accepted | 1044 ms | 9544 KB | 2022-08-02 16:09:26 | 2022-08-02 16:09:26 |
R=lambda:map(int,input().split()) n,m=R() *c,=R() b=[[0],[0]] f=max for x in b: for u,v in zip([0]+c,c):x+=x[-1]+f(0,u-v), f=min for _ in[0]*m:s,t=R();l=b[s>t];print(l[t]-l[s])
?
?
?
?