結果

問題 No.1201 お菓子配り-4
ユーザー tamatotamato
提出日時 2020-08-28 22:50:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,023 ms / 4,000 ms
コード長 630 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 64,240 KB
最終ジャッジ日時 2024-04-26 13:39:23
合計ジャッジ時間 13,617 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
62,184 KB
testcase_01 AC 517 ms
61,996 KB
testcase_02 AC 722 ms
62,640 KB
testcase_03 AC 375 ms
62,132 KB
testcase_04 AC 206 ms
63,492 KB
testcase_05 AC 447 ms
63,308 KB
testcase_06 AC 106 ms
62,152 KB
testcase_07 AC 226 ms
63,344 KB
testcase_08 AC 550 ms
63,188 KB
testcase_09 AC 417 ms
62,596 KB
testcase_10 AC 48 ms
62,220 KB
testcase_11 AC 141 ms
61,452 KB
testcase_12 AC 818 ms
63,196 KB
testcase_13 AC 66 ms
62,476 KB
testcase_14 AC 56 ms
60,604 KB
testcase_15 AC 654 ms
62,200 KB
testcase_16 AC 230 ms
62,956 KB
testcase_17 AC 284 ms
63,456 KB
testcase_18 AC 85 ms
63,420 KB
testcase_19 AC 82 ms
61,932 KB
testcase_20 AC 38 ms
53,204 KB
testcase_21 AC 37 ms
52,388 KB
testcase_22 AC 38 ms
53,268 KB
testcase_23 AC 39 ms
52,660 KB
testcase_24 AC 38 ms
53,332 KB
testcase_25 AC 37 ms
53,420 KB
testcase_26 AC 38 ms
53,056 KB
testcase_27 AC 38 ms
52,996 KB
testcase_28 AC 37 ms
53,632 KB
testcase_29 AC 38 ms
53,112 KB
testcase_30 AC 1,019 ms
62,628 KB
testcase_31 AC 1,019 ms
64,240 KB
testcase_32 AC 1,021 ms
62,356 KB
testcase_33 AC 1,023 ms
62,928 KB
testcase_34 AC 1,021 ms
62,248 KB
testcase_35 AC 503 ms
64,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from math import gcd
    input = sys.stdin.readline

    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:
            c, d = divmod(a, b)
            ans = (ans + ((c * b)%mod * (b+1))%mod)%mod
            if d != 0:
                ans = (ans + (d*2))%mod
                ans = (ans + ((d-1) * (b-1))%mod)%mod

                bb = b // gcd(b, d)
                ans = (ans + (b-1) // bb)%mod
    print(ans)


if __name__ == '__main__':
    main()
0