Contest Duration: - (local time) (120 minutes) Back to Home

Submission #9425232

Source Code Expand

Copy
import sys

import numpy as np

MOD = 10 ** 9 + 7

def cumprod(A, MOD = MOD):
L = len(A); Lsq = int(L**.5+1)
A = np.resize(A, Lsq**2).reshape(Lsq,Lsq)
for n in range(1,Lsq):
A[:,n] *= A[:,n-1]; A[:,n] %= MOD
for n in range(1,Lsq):
A[n] *= A[n-1,-1]; A[n] %= MOD
return A.ravel()[:L]
def make_fact(U, MOD = MOD):
x = np.arange(U, dtype = np.int64); x[0] = 1
fact = cumprod(x, MOD)
x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
fact_inv = cumprod(x, MOD)[::-1]
return fact,fact_inv

U = 10 ** 5 + 5
fact, fact_inv = make_fact(U)

inv = np.zeros(U,np.int64)
inv[1:] = fact_inv[1:] * fact[:-1] % MOD

coef = inv[1:N].cumsum() % MOD

answer = (np.diff(X) * coef % MOD).sum() % MOD

#### Submission Info

Submission Time 2020-01-11 21:47:41+0900 B - Fusing Slimes maspy Python (3.4.3) 600 1016 Byte AC 192 ms 19492 KB

#### Judge Result

Score / Max Score 0 / 0 400 / 400 200 / 200
Status
 AC × 2
 AC × 15
 AC × 32
Set Name Test Cases
Sample sample_01, sample_02
Subtask small_01, small_02, small_03, small_04, small_05, small_06, small_07, small_08, small_09, small_10, small_max_01, small_max_02, small_max_03, small_max_04, small_max_05
All max_01, max_02, max_03, max_04, max_05, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, sample_01, sample_02, small_01, small_02, small_03, small_04, small_05, small_06, small_07, small_08, small_09, small_10, small_max_01, small_max_02, small_max_03, small_max_04, small_max_05
Case Name Status Exec Time Memory
max_01 AC 191 ms 19488 KB
max_02 AC 190 ms 19492 KB
max_03 AC 190 ms 19492 KB
max_04 AC 191 ms 19492 KB
max_05 AC 192 ms 19492 KB
random_01 AC 175 ms 18260 KB
random_02 AC 190 ms 19296 KB
random_03 AC 183 ms 18740 KB
random_04 AC 179 ms 18564 KB
random_05 AC 171 ms 17920 KB
random_06 AC 181 ms 18636 KB
random_07 AC 173 ms 18068 KB
random_08 AC 178 ms 18472 KB
random_09 AC 184 ms 18908 KB
random_10 AC 179 ms 18580 KB
sample_01 AC 170 ms 17920 KB
sample_02 AC 171 ms 17920 KB
small_01 AC 170 ms 17920 KB
small_02 AC 169 ms 17920 KB
small_03 AC 169 ms 17836 KB
small_04 AC 169 ms 17920 KB
small_05 AC 169 ms 17920 KB
small_06 AC 171 ms 17920 KB
small_07 AC 171 ms 17836 KB
small_08 AC 170 ms 17920 KB
small_09 AC 169 ms 17836 KB
small_10 AC 170 ms 17920 KB
small_max_01 AC 171 ms 17920 KB
small_max_02 AC 170 ms 17920 KB
small_max_03 AC 169 ms 17920 KB
small_max_04 AC 171 ms 17920 KB
small_max_05 AC 170 ms 17836 KB