Submission #65674810


Source Code Expand

from itertools import accumulate
from operator import add


def main():
    n = int(input().strip())
    a = list(map(int, input().strip().split()))
    ps = list(accumulate(a[:0:-1], add, initial=0))[::-1]
    s = 0
    for i in range(n):
        s += a[i] * ps[i]
    print(s)


main()

Submission Info

Submission Time
Task C - Sum of Product
User xv1r
Language Python (PyPy 3.10-v7.3.12)
Score 300
Code Size 301 Byte
Status AC
Exec Time 104 ms
Memory 145480 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 22
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 57 ms 76680 KiB
00_sample_01.txt AC 58 ms 76392 KiB
00_sample_02.txt AC 59 ms 76948 KiB
01_random_00.txt AC 76 ms 108736 KiB
01_random_01.txt AC 91 ms 134176 KiB
01_random_02.txt AC 99 ms 134412 KiB
01_random_03.txt AC 79 ms 112964 KiB
01_random_04.txt AC 93 ms 135048 KiB
01_random_05.txt AC 102 ms 135840 KiB
01_random_06.txt AC 102 ms 136132 KiB
01_random_07.txt AC 104 ms 136048 KiB
01_random_08.txt AC 103 ms 135848 KiB
01_random_09.txt AC 102 ms 135740 KiB
01_random_10.txt AC 104 ms 136160 KiB
01_random_11.txt AC 103 ms 135836 KiB
01_random_12.txt AC 102 ms 135832 KiB
01_random_13.txt AC 102 ms 135608 KiB
01_random_14.txt AC 102 ms 135848 KiB
02_handmade_00.txt AC 57 ms 76628 KiB
02_handmade_01.txt AC 58 ms 76588 KiB
02_handmade_02.txt AC 99 ms 145480 KiB
02_handmade_03.txt AC 104 ms 133812 KiB