Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #9613690

Source Code Expand

Copy
```import sys

import numpy as np

MOD = 10 ** 9 + 7

U = 10 ** 6 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3,U,2):
if p*p > U:
break
if is_prime[p]:
is_prime[p*p::p+p] = 0

M = 10 ** 3
small_primes = np.where(is_prime[:M])[0].tolist()

B = A.copy()
lcm = 1
for p in small_primes:
e = 0
while np.any(A % p == 0):
e += 1
A[A % p ==0] //= p
lcm *= p**e
lcm %= MOD

for x in set(A.tolist()):
lcm *= x
lcm %= MOD

answer = sum(pow(x, MOD-2, MOD) for x in B.tolist()) % MOD

#### Submission Info

Submission Time 2020-01-19 21:16:01+0900 E - Flatten maspy Python (3.4.3) 500 822 Byte AC 330 ms 22608 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
 AC × 3
 AC × 18
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, hand_03, max_01, max_02, max_03, max_04, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_01 330 ms 22608 KB
hand_02 156 ms 13452 KB
hand_03 157 ms 13452 KB
max_01 294 ms 14220 KB
max_02 217 ms 14224 KB
max_03 241 ms 13580 KB
max_04 219 ms 13712 KB
random_01 166 ms 13452 KB
random_02 240 ms 13580 KB
random_03 239 ms 13708 KB
random_04 181 ms 13452 KB
random_05 276 ms 13836 KB
random_06 213 ms 13580 KB
random_07 173 ms 13456 KB
random_08 164 ms 13452 KB
sample_01 157 ms 13452 KB
sample_02 155 ms 13456 KB
sample_03 156 ms 13452 KB