Submission #20750002


Source Code Expand

N = int(input())
A = list(map(int, input().split()))
ans = 0
calc = 0
for a in A:
    ans += a ** 2
    calc += a
ans *= N - 1
for a in A:
    calc -= a
    ans -= 2 * calc * a
print(ans)

Submission Info

Submission Time
Task C - Squared Error
User hirofumi999
Language PyPy3 (7.3.0)
Score 300
Code Size 198 Byte
Status AC
Exec Time 121 ms
Memory 103304 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 15
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All handmade_00.txt, handmade_01.txt, max_00.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, same_00.txt, same_01.txt, same_02.txt, same_03.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
handmade_00.txt AC 69 ms 61756 KiB
handmade_01.txt AC 50 ms 61588 KiB
max_00.txt AC 118 ms 103304 KiB
random_00.txt AC 120 ms 102488 KiB
random_01.txt AC 121 ms 102664 KiB
random_02.txt AC 119 ms 102508 KiB
random_03.txt AC 110 ms 98604 KiB
random_04.txt AC 98 ms 90884 KiB
random_05.txt AC 90 ms 87796 KiB
same_00.txt AC 114 ms 100232 KiB
same_01.txt AC 121 ms 103180 KiB
same_02.txt AC 59 ms 61928 KiB
same_03.txt AC 109 ms 96444 KiB
sample_01.txt AC 56 ms 61788 KiB
sample_02.txt AC 51 ms 61584 KiB