Submission #21972607


Source Code Expand

from itertools import accumulate


def main():
    n = int(input())
    scores = [[0 for j in range(n)] for i in range(2)]
    for i in range(n):
        c, p = map(int, input().split())
        c -= 1
        scores[c][i] = p

    accums = [list(accumulate(s, initial=0)) for s in scores]
    q = int(input())
    for _ in range(q):
        l, r = map(int, input().split())
        l -= 1
        print(*(a[r] - a[l] for a in accums))


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task 010 - Score Sum Queries(★2)
User riantkb
Language Python (3.8.2)
Score 2
Code Size 476 Byte
Status AC
Exec Time 632 ms
Memory 18532 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 2 / 2
Status
AC × 4
AC × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All hand01.txt, hand02.txt, hand03.txt, hand04.txt, hand05.txt, hand06.txt, random01.txt, random02.txt, random03.txt, random04.txt, random05.txt, random06.txt, random07.txt, random08.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
hand01.txt AC 22 ms 8900 KiB
hand02.txt AC 27 ms 8892 KiB
hand03.txt AC 629 ms 15308 KiB
hand04.txt AC 632 ms 15300 KiB
hand05.txt AC 592 ms 18532 KiB
hand06.txt AC 631 ms 12152 KiB
random01.txt AC 453 ms 13792 KiB
random02.txt AC 541 ms 14620 KiB
random03.txt AC 386 ms 11120 KiB
random04.txt AC 242 ms 10516 KiB
random05.txt AC 289 ms 11152 KiB
random06.txt AC 188 ms 10268 KiB
random07.txt AC 260 ms 10260 KiB
random08.txt AC 64 ms 9628 KiB
sample_01.txt AC 23 ms 8988 KiB
sample_02.txt AC 23 ms 8980 KiB
sample_03.txt AC 19 ms 8892 KiB
sample_04.txt AC 20 ms 9040 KiB