結果

問題 No.1201 お菓子配り-4
ユーザー 👑 tamatotamato
提出日時 2020-08-28 22:50:28
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,145 ms / 4,000 ms
コード長 630 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 77,068 KB
最終ジャッジ日時 2023-08-08 21:24:14
合計ジャッジ時間 15,993 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
76,528 KB
testcase_01 AC 594 ms
76,656 KB
testcase_02 AC 813 ms
76,584 KB
testcase_03 AC 437 ms
76,708 KB
testcase_04 AC 255 ms
76,524 KB
testcase_05 AC 514 ms
77,068 KB
testcase_06 AC 143 ms
76,356 KB
testcase_07 AC 277 ms
76,704 KB
testcase_08 AC 625 ms
76,796 KB
testcase_09 AC 482 ms
76,756 KB
testcase_10 AC 81 ms
76,656 KB
testcase_11 AC 184 ms
76,604 KB
testcase_12 AC 919 ms
76,880 KB
testcase_13 AC 100 ms
76,688 KB
testcase_14 AC 89 ms
76,472 KB
testcase_15 AC 738 ms
76,880 KB
testcase_16 AC 280 ms
76,884 KB
testcase_17 AC 338 ms
76,704 KB
testcase_18 AC 120 ms
76,628 KB
testcase_19 AC 117 ms
76,620 KB
testcase_20 AC 70 ms
71,732 KB
testcase_21 AC 72 ms
71,904 KB
testcase_22 AC 72 ms
71,764 KB
testcase_23 AC 73 ms
71,928 KB
testcase_24 AC 71 ms
71,536 KB
testcase_25 AC 72 ms
71,680 KB
testcase_26 AC 71 ms
71,656 KB
testcase_27 AC 71 ms
71,460 KB
testcase_28 AC 70 ms
71,452 KB
testcase_29 AC 71 ms
71,628 KB
testcase_30 AC 1,140 ms
76,620 KB
testcase_31 AC 1,141 ms
76,804 KB
testcase_32 AC 1,145 ms
76,500 KB
testcase_33 AC 1,142 ms
76,520 KB
testcase_34 AC 1,139 ms
76,888 KB
testcase_35 AC 537 ms
76,884 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