Submission #9395610


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,M,*A = map(int,read().split())

# 「奇数倍」に帰着
A = [x >> 1 for x in A]

def merge(a,b):
    g = gcd(a,b)
    a //= g; b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n

x = reduce(merge, A)
if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))

print(answer)

Submission Info

Submission Time
Task D - Semi Common Multiple
User maspy
Language Python (3.4.3)
Score 400
Code Size 585 Byte
Status AC
Exec Time 119 ms
Memory 14504 KB

Judge Result

Set Name Sample All after_contest
Score / Max Score 0 / 0 400 / 400 0 / 0
Status
AC × 3
AC × 96
AC
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, 54.txt, 55.txt, 56.txt, 57.txt, 58.txt, 59.txt, 60.txt, 61.txt, 62.txt, 63.txt, 64.txt, 65.txt, 66.txt, 67.txt, 68.txt, 69.txt, 70.txt, 71.txt, 72.txt, 73.txt, 74.txt, 75.txt, 76.txt, 77.txt, 78.txt, 79.txt, 80.txt, 81.txt, 82.txt, 83.txt, 84.txt, 85.txt, 86.txt, 87.txt, 88.txt, 89.txt, 90.txt, 91.txt, 92.txt, 93.txt, s1.txt, s2.txt, s3.txt
after_contest
Case Name Status Exec Time Memory
01.txt AC 35 ms 5048 KB
02.txt AC 64 ms 8156 KB
03.txt AC 34 ms 5084 KB
04.txt AC 75 ms 10448 KB
05.txt AC 35 ms 5048 KB
06.txt AC 44 ms 6108 KB
07.txt AC 35 ms 5048 KB
08.txt AC 44 ms 5596 KB
09.txt AC 35 ms 5048 KB
10.txt AC 65 ms 8352 KB
11.txt AC 34 ms 5048 KB
12.txt AC 76 ms 10500 KB
13.txt AC 35 ms 5048 KB
14.txt AC 115 ms 13476 KB
15.txt AC 35 ms 5048 KB
16.txt AC 38 ms 5468 KB
17.txt AC 36 ms 5048 KB
18.txt AC 84 ms 9724 KB
19.txt AC 35 ms 5048 KB
20.txt AC 60 ms 8564 KB
21.txt AC 35 ms 5048 KB
22.txt AC 93 ms 10572 KB
23.txt AC 35 ms 5048 KB
24.txt AC 86 ms 11772 KB
25.txt AC 35 ms 5048 KB
26.txt AC 118 ms 13804 KB
27.txt AC 35 ms 5048 KB
28.txt AC 62 ms 8556 KB
29.txt AC 34 ms 5048 KB
30.txt AC 87 ms 9976 KB
31.txt AC 35 ms 5048 KB
32.txt AC 98 ms 13832 KB
33.txt AC 35 ms 5048 KB
34.txt AC 58 ms 7656 KB
35.txt AC 35 ms 5048 KB
36.txt AC 49 ms 6876 KB
37.txt AC 34 ms 5048 KB
38.txt AC 89 ms 10552 KB
39.txt AC 35 ms 5048 KB
40.txt AC 50 ms 7132 KB
41.txt AC 35 ms 5048 KB
42.txt AC 100 ms 11576 KB
43.txt AC 36 ms 5048 KB
44.txt AC 90 ms 12392 KB
45.txt AC 34 ms 5048 KB
46.txt AC 42 ms 5852 KB
47.txt AC 36 ms 5048 KB
48.txt AC 87 ms 11872 KB
49.txt AC 51 ms 7400 KB
50.txt AC 79 ms 11228 KB
51.txt AC 41 ms 5980 KB
52.txt AC 69 ms 9836 KB
53.txt AC 37 ms 5048 KB
54.txt AC 100 ms 11264 KB
55.txt AC 35 ms 5048 KB
56.txt AC 54 ms 7644 KB
57.txt AC 36 ms 5048 KB
58.txt AC 70 ms 8408 KB
59.txt AC 36 ms 5048 KB
60.txt AC 61 ms 7420 KB
61.txt AC 35 ms 5048 KB
62.txt AC 38 ms 5212 KB
63.txt AC 35 ms 5048 KB
64.txt AC 94 ms 12752 KB
65.txt AC 35 ms 5048 KB
66.txt AC 105 ms 11988 KB
67.txt AC 35 ms 5048 KB
68.txt AC 73 ms 9076 KB
69.txt AC 35 ms 5048 KB
70.txt AC 35 ms 5048 KB
71.txt AC 35 ms 5048 KB
72.txt AC 73 ms 10216 KB
73.txt AC 46 ms 6364 KB
74.txt AC 65 ms 9048 KB
75.txt AC 69 ms 7768 KB
76.txt AC 111 ms 12736 KB
77.txt AC 75 ms 8036 KB
78.txt AC 99 ms 13320 KB
79.txt AC 64 ms 5724 KB
80.txt AC 111 ms 12204 KB
81.txt AC 119 ms 14476 KB
82.txt AC 119 ms 14356 KB
83.txt AC 35 ms 5084 KB
84.txt AC 112 ms 13348 KB
85.txt AC 35 ms 5048 KB
86.txt AC 35 ms 5048 KB
87.txt AC 36 ms 5048 KB
88.txt AC 117 ms 6884 KB
89.txt AC 112 ms 10804 KB
90.txt AC 115 ms 8804 KB
91.txt AC 119 ms 14504 KB
92.txt AC 101 ms 14472 KB
93.txt AC 100 ms 14488 KB
s1.txt AC 35 ms 5048 KB
s2.txt AC 35 ms 5048 KB
s3.txt AC 35 ms 5048 KB