結果

問題 No.1201 お菓子配り-4
ユーザー 37zigen37zigen
提出日時 2020-08-30 07:53:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 995 ms / 4,000 ms
コード長 279 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 64,372 KB
最終ジャッジ日時 2024-04-27 01:34:18
合計ジャッジ時間 12,725 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
60,348 KB
testcase_01 AC 496 ms
63,060 KB
testcase_02 AC 703 ms
63,056 KB
testcase_03 AC 361 ms
61,840 KB
testcase_04 AC 199 ms
61,672 KB
testcase_05 AC 434 ms
63,668 KB
testcase_06 AC 100 ms
60,880 KB
testcase_07 AC 222 ms
63,296 KB
testcase_08 AC 536 ms
63,820 KB
testcase_09 AC 409 ms
63,056 KB
testcase_10 AC 50 ms
62,132 KB
testcase_11 AC 137 ms
61,264 KB
testcase_12 AC 797 ms
64,372 KB
testcase_13 AC 63 ms
61,080 KB
testcase_14 AC 53 ms
60,460 KB
testcase_15 AC 636 ms
63,328 KB
testcase_16 AC 222 ms
61,360 KB
testcase_17 AC 273 ms
62,132 KB
testcase_18 AC 81 ms
61,456 KB
testcase_19 AC 79 ms
61,036 KB
testcase_20 AC 37 ms
53,880 KB
testcase_21 AC 36 ms
53,104 KB
testcase_22 AC 38 ms
52,732 KB
testcase_23 AC 37 ms
52,920 KB
testcase_24 AC 36 ms
52,176 KB
testcase_25 AC 36 ms
53,212 KB
testcase_26 AC 36 ms
52,288 KB
testcase_27 AC 37 ms
52,756 KB
testcase_28 AC 36 ms
52,372 KB
testcase_29 AC 37 ms
52,128 KB
testcase_30 AC 989 ms
63,900 KB
testcase_31 AC 992 ms
64,152 KB
testcase_32 AC 991 ms
63,348 KB
testcase_33 AC 991 ms
64,160 KB
testcase_34 AC 995 ms
63,116 KB
testcase_35 AC 60 ms
62,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
MOD=10**9+7
N=int(input())
M=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for a in A:
    for b in B:
        d=b//gcd(a,b)
        W=b
        H=W*a//b
        ans+=(H+1)*(W+1)-2*W+(W-1)//d
        ans%=MOD
print(ans)
0