結果

問題 No.1201 お菓子配り-4
ユーザー marroncastlemarroncastle
提出日時 2020-08-28 22:57:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 898 ms / 4,000 ms
コード長 342 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 63,052 KB
最終ジャッジ日時 2024-04-26 13:43:44
合計ジャッジ時間 12,191 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
60,400 KB
testcase_01 AC 457 ms
60,916 KB
testcase_02 AC 639 ms
61,152 KB
testcase_03 AC 333 ms
61,624 KB
testcase_04 AC 185 ms
61,512 KB
testcase_05 AC 396 ms
61,092 KB
testcase_06 AC 96 ms
59,196 KB
testcase_07 AC 203 ms
62,120 KB
testcase_08 AC 485 ms
61,804 KB
testcase_09 AC 368 ms
61,152 KB
testcase_10 AC 46 ms
60,084 KB
testcase_11 AC 128 ms
60,556 KB
testcase_12 AC 716 ms
61,980 KB
testcase_13 AC 63 ms
60,360 KB
testcase_14 AC 52 ms
60,652 KB
testcase_15 AC 573 ms
63,052 KB
testcase_16 AC 204 ms
60,744 KB
testcase_17 AC 253 ms
61,192 KB
testcase_18 AC 78 ms
61,432 KB
testcase_19 AC 74 ms
60,148 KB
testcase_20 AC 37 ms
52,944 KB
testcase_21 AC 37 ms
52,812 KB
testcase_22 AC 37 ms
53,680 KB
testcase_23 AC 38 ms
53,212 KB
testcase_24 AC 38 ms
52,748 KB
testcase_25 AC 38 ms
52,748 KB
testcase_26 AC 38 ms
52,724 KB
testcase_27 AC 38 ms
53,692 KB
testcase_28 AC 37 ms
53,112 KB
testcase_29 AC 39 ms
52,064 KB
testcase_30 AC 898 ms
62,360 KB
testcase_31 AC 897 ms
61,080 KB
testcase_32 AC 898 ms
61,080 KB
testcase_33 AC 898 ms
62,296 KB
testcase_34 AC 897 ms
62,428 KB
testcase_35 AC 349 ms
62,308 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