Submission #9644341


Source Code Expand

Copy
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from fractions import gcd
from functools import reduce

N,*A = map(int,read().split())

MOD = 10 ** 9 + 7

lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)

answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)

Submission Info

Submission Time
Task E - Flatten
User maspy
Language Python3 (3.4.3)
Score 500
Code Size 347 Byte
Status
Exec Time 1507 ms
Memory 6008 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01, sample_02, sample_03
All 500 / 500 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 34 ms 5076 KB
hand_02 34 ms 5076 KB
hand_03 35 ms 5076 KB
max_01 717 ms 6008 KB
max_02 1507 ms 6008 KB
max_03 42 ms 5880 KB
max_04 40 ms 5880 KB
random_01 37 ms 5076 KB
random_02 246 ms 5624 KB
random_03 259 ms 5624 KB
random_04 56 ms 5112 KB
random_05 425 ms 5752 KB
random_06 135 ms 5368 KB
random_07 46 ms 5112 KB
random_08 37 ms 5076 KB
sample_01 35 ms 5076 KB
sample_02 34 ms 5076 KB
sample_03 34 ms 5076 KB