Submission #5993390


Source Code Expand

Copy
N=int(input())
A=list(map(int,input().split()))
kaijo=[0]*(1+N)
kaijo[0]=1
mod=10**9+7
for i in range(1,1+N):
    kaijo[i]=kaijo[i-1]*i%mod
ruiseki=[0]*(N+1)
ruiseki[1]=1
for i in range(2,N+1):
    ruiseki[i]=(ruiseki[i-1]+pow(i,mod-2,mod))%mod
ans=0
for i,a in enumerate(A):
    ans=(ans+kaijo[N]*a*(ruiseki[i+1]+ruiseki[N-i]-1)%mod)%mod
print(ans)

Submission Info

Submission Time
Task B - Removing Blocks
User gratan
Language Python3 (3.4.3)
Score 600
Code Size 363 Byte
Status
Exec Time 528 ms
Memory 15204 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
All 600 / 600 sample-01.txt, sample-02.txt, sample-03.txt, sample-01.txt, sample-02.txt, sample-03.txt, subtask01-01.txt, subtask01-02.txt, subtask01-03.txt, subtask01-04.txt, subtask01-05.txt, subtask01-06.txt, subtask01-07.txt, subtask01-08.txt, subtask01-09.txt, subtask01-10.txt, subtask01-11.txt, subtask01-12.txt, subtask01-13.txt
Case Name Status Exec Time Memory
sample-01.txt 17 ms 3064 KB
sample-02.txt 17 ms 3064 KB
sample-03.txt 17 ms 3064 KB
subtask01-01.txt 17 ms 3064 KB
subtask01-02.txt 393 ms 11884 KB
subtask01-03.txt 310 ms 9904 KB
subtask01-04.txt 392 ms 11764 KB
subtask01-05.txt 143 ms 5936 KB
subtask01-06.txt 225 ms 7836 KB
subtask01-07.txt 139 ms 5840 KB
subtask01-08.txt 528 ms 15204 KB
subtask01-09.txt 521 ms 14820 KB
subtask01-10.txt 523 ms 15204 KB
subtask01-11.txt 521 ms 14820 KB
subtask01-12.txt 522 ms 14824 KB
subtask01-13.txt 521 ms 14824 KB