結果

問題 No.1201 お菓子配り-4
ユーザー tpynerivertpyneriver
提出日時 2020-08-28 22:44:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,780 ms / 4,000 ms
コード長 435 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 76,372 KB
最終ジャッジ日時 2024-04-26 13:36:37
合計ジャッジ時間 20,744 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
75,280 KB
testcase_01 AC 759 ms
75,720 KB
testcase_02 AC 1,046 ms
75,956 KB
testcase_03 AC 534 ms
75,920 KB
testcase_04 AC 291 ms
75,952 KB
testcase_05 AC 641 ms
75,776 KB
testcase_06 AC 140 ms
75,688 KB
testcase_07 AC 323 ms
76,240 KB
testcase_08 AC 790 ms
76,020 KB
testcase_09 AC 586 ms
76,024 KB
testcase_10 AC 55 ms
71,188 KB
testcase_11 AC 199 ms
76,372 KB
testcase_12 AC 1,206 ms
76,168 KB
testcase_13 AC 82 ms
75,736 KB
testcase_14 AC 67 ms
75,768 KB
testcase_15 AC 943 ms
75,888 KB
testcase_16 AC 318 ms
75,980 KB
testcase_17 AC 409 ms
76,008 KB
testcase_18 AC 105 ms
76,208 KB
testcase_19 AC 103 ms
75,912 KB
testcase_20 AC 37 ms
52,936 KB
testcase_21 AC 37 ms
53,952 KB
testcase_22 AC 37 ms
53,764 KB
testcase_23 AC 36 ms
53,152 KB
testcase_24 AC 36 ms
52,768 KB
testcase_25 AC 36 ms
53,348 KB
testcase_26 AC 36 ms
53,004 KB
testcase_27 AC 36 ms
52,408 KB
testcase_28 AC 36 ms
52,308 KB
testcase_29 AC 36 ms
52,940 KB
testcase_30 AC 1,454 ms
76,016 KB
testcase_31 AC 1,496 ms
75,836 KB
testcase_32 AC 1,462 ms
75,940 KB
testcase_33 AC 1,501 ms
76,148 KB
testcase_34 AC 1,480 ms
75,956 KB
testcase_35 AC 2,780 ms
75,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline
MOD = 10**9+7

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

N = int(readline())
M = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))

ans = 0
for a in A:
    for b in B:
        l = a//b
        ans = (ans + 2*l*b*(b+1)//2)%MOD
        k = a%b
        g = gcd(b, k)
        ans = (ans + 2*(k*(b+1)-b+g)//2)%MOD

print(ans)
        
0