95802024-02-23 12:14:21KezdőMI bróker (50 pont)python3Runtime error 0/5021ms16076 KiB
from sys import stdin,stdout

def haszon(V,E):
    H = 0
    van = False
    for a in ar:
        if not van and a <= V:
            H -= a
            van = True
        if van and a >= E:
            H += a
            van = False
##        print(H)
    stdout.write(str(H)+'\n')

def main():
    N,Q = [int(i) for i in input().split()]
    ar = [int(i) for i in stdin.readline().split()]

    for i in range(Q):
        V,E = [int(i) for i in stdin.readline().split()]
        haszon(V,E)

main()
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/017ms11312 KiB
2Runtime error0/020ms13444 KiB
3Runtime error0/118ms11624 KiB
4Runtime error0/117ms11788 KiB
5Runtime error0/217ms12280 KiB
6Runtime error0/220ms14212 KiB
7Runtime error0/221ms14468 KiB
8Runtime error0/120ms14184 KiB
9Runtime error0/121ms14296 KiB
10Runtime error0/220ms13988 KiB
11Runtime error0/220ms14568 KiB
12Runtime error0/221ms15180 KiB
13Runtime error0/221ms14504 KiB
14Runtime error0/220ms15212 KiB
15Runtime error0/320ms15184 KiB
16Runtime error0/320ms15292 KiB
17Runtime error0/321ms15576 KiB
18Runtime error0/321ms15652 KiB
19Runtime error0/320ms15800 KiB
20Runtime error0/320ms15712 KiB
21Runtime error0/321ms15724 KiB
22Runtime error0/321ms16076 KiB
23Runtime error0/321ms15932 KiB
24Runtime error0/320ms15856 KiB