結果

問題 No.1201 お菓子配り-4
ユーザー tpynerivertpyneriver
提出日時 2020-08-28 22:44:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,984 ms / 4,000 ms
コード長 435 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 77,356 KB
最終ジャッジ日時 2023-08-08 21:21:15
合計ジャッジ時間 22,850 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
76,628 KB
testcase_01 AC 808 ms
77,060 KB
testcase_02 AC 1,114 ms
77,148 KB
testcase_03 AC 582 ms
77,044 KB
testcase_04 AC 323 ms
77,124 KB
testcase_05 AC 693 ms
77,208 KB
testcase_06 AC 172 ms
76,464 KB
testcase_07 AC 361 ms
77,168 KB
testcase_08 AC 856 ms
77,356 KB
testcase_09 AC 649 ms
77,156 KB
testcase_10 AC 86 ms
76,484 KB
testcase_11 AC 231 ms
77,224 KB
testcase_12 AC 1,260 ms
77,296 KB
testcase_13 AC 112 ms
77,168 KB
testcase_14 AC 96 ms
76,684 KB
testcase_15 AC 1,004 ms
77,156 KB
testcase_16 AC 366 ms
77,216 KB
testcase_17 AC 445 ms
77,172 KB
testcase_18 AC 138 ms
77,028 KB
testcase_19 AC 136 ms
77,108 KB
testcase_20 AC 69 ms
71,220 KB
testcase_21 AC 69 ms
71,052 KB
testcase_22 AC 69 ms
71,352 KB
testcase_23 AC 69 ms
71,268 KB
testcase_24 AC 68 ms
71,232 KB
testcase_25 AC 70 ms
71,360 KB
testcase_26 AC 70 ms
71,352 KB
testcase_27 AC 69 ms
71,264 KB
testcase_28 AC 69 ms
71,372 KB
testcase_29 AC 70 ms
71,392 KB
testcase_30 AC 1,572 ms
77,116 KB
testcase_31 AC 1,565 ms
77,352 KB
testcase_32 AC 1,568 ms
77,316 KB
testcase_33 AC 1,572 ms
77,164 KB
testcase_34 AC 1,564 ms
77,164 KB
testcase_35 AC 2,984 ms
77,132 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