結果

問題 No.1201 お菓子配り-4
ユーザー marroncastlemarroncastle
提出日時 2020-08-28 22:57:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,017 ms / 4,000 ms
コード長 342 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 76,496 KB
最終ジャッジ日時 2023-08-08 21:28:39
合計ジャッジ時間 14,519 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
75,792 KB
testcase_01 AC 522 ms
76,144 KB
testcase_02 AC 728 ms
76,424 KB
testcase_03 AC 385 ms
76,360 KB
testcase_04 AC 223 ms
76,228 KB
testcase_05 AC 449 ms
76,416 KB
testcase_06 AC 129 ms
75,948 KB
testcase_07 AC 246 ms
76,240 KB
testcase_08 AC 547 ms
76,180 KB
testcase_09 AC 422 ms
76,200 KB
testcase_10 AC 77 ms
76,044 KB
testcase_11 AC 164 ms
76,320 KB
testcase_12 AC 809 ms
76,136 KB
testcase_13 AC 94 ms
76,212 KB
testcase_14 AC 85 ms
76,040 KB
testcase_15 AC 656 ms
76,216 KB
testcase_16 AC 252 ms
76,044 KB
testcase_17 AC 305 ms
76,448 KB
testcase_18 AC 114 ms
76,288 KB
testcase_19 AC 108 ms
76,192 KB
testcase_20 AC 69 ms
71,392 KB
testcase_21 AC 69 ms
71,356 KB
testcase_22 AC 66 ms
71,600 KB
testcase_23 AC 70 ms
71,316 KB
testcase_24 AC 70 ms
71,384 KB
testcase_25 AC 71 ms
71,360 KB
testcase_26 AC 70 ms
71,304 KB
testcase_27 AC 69 ms
71,576 KB
testcase_28 AC 72 ms
71,280 KB
testcase_29 AC 71 ms
71,312 KB
testcase_30 AC 1,002 ms
76,244 KB
testcase_31 AC 1,006 ms
76,048 KB
testcase_32 AC 1,012 ms
76,496 KB
testcase_33 AC 1,017 ms
76,332 KB
testcase_34 AC 1,016 ms
76,280 KB
testcase_35 AC 372 ms
76,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
def solve():
    mod = 10**9+7
    N = int(input())
    M = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    ans = (sum(B)+M)*sum(A)%mod
    for a in A:
        for b in B:
            g = gcd(a,b)
            ans -= (b//g)*(b//g-1)*g*g//b
    return ans%mod
print(solve())
0