86322024-01-24 09:54:28lacitoMI bróker (50 pont)cpp17Forditási hiba
from sys import stdin, stdout

def main():
    MAXA = 501
    ans = [[0] * 512 for _ in range(512)]

    _, q = map(int, stdin.readline().split())
    a = list(map(int, stdin.readline().split()))
    for v in range(1, MAXA):
        e_min = MAXA
        for x in a:
            if (x <= v):
                ans[v][v + 1] -= x
                ans[v][e_min] += x
                e_min = v + 1
            elif (x >= e_min):
                ans[v][e_min] += x
                ans[v][x + 1] -= x
                e_min = x + 1
        for e in range(v + 1, MAXA):
            ans[v][e] += ans[v][e - 1]
    
    profit = [0] * q
    for i, ve in enumerate(stdin.readlines()):
        v, e = map(int, ve.split())
        profit[i] = ans[v][e]
    
    stdout.write('\n'.join(str(p) for p in profit) + '\n')
    
main()
Forditási hiba
exit status 1
main.cpp:1:1: error: 'from' does not name a type
    1 | from sys import stdin, stdout
      | ^~~~
Exited with error status 1