ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1330. Intervals

Time limit exceeded on test 20 on python
Posted by Malve 12 Mar 2022 13:49
Can you suggest what is causing this error.

N = int(input())
s = [0]

for i in range(N):
   k = int(input())
   s.append(int(s[i] + k))

Q = int(input())
while Q:
   l, r = map(int, input().split())
   print(s[r] - s[l-1])
   Q -= 1