結果

問題 No.1201 お菓子配り-4
ユーザー qumazakiqumazaki
提出日時 2020-08-30 01:49:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 805 ms / 4,000 ms
コード長 314 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 63,972 KB
最終ジャッジ日時 2024-04-27 01:26:56
合計ジャッジ時間 10,812 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
59,720 KB
testcase_01 AC 397 ms
62,088 KB
testcase_02 AC 548 ms
62,556 KB
testcase_03 AC 287 ms
62,060 KB
testcase_04 AC 166 ms
60,728 KB
testcase_05 AC 349 ms
62,768 KB
testcase_06 AC 89 ms
61,436 KB
testcase_07 AC 183 ms
61,896 KB
testcase_08 AC 416 ms
62,248 KB
testcase_09 AC 327 ms
62,644 KB
testcase_10 AC 47 ms
62,664 KB
testcase_11 AC 121 ms
61,768 KB
testcase_12 AC 641 ms
63,420 KB
testcase_13 AC 58 ms
60,240 KB
testcase_14 AC 48 ms
59,900 KB
testcase_15 AC 520 ms
63,760 KB
testcase_16 AC 180 ms
60,712 KB
testcase_17 AC 215 ms
61,600 KB
testcase_18 AC 69 ms
60,620 KB
testcase_19 AC 70 ms
60,112 KB
testcase_20 AC 35 ms
52,492 KB
testcase_21 AC 36 ms
52,780 KB
testcase_22 AC 35 ms
52,484 KB
testcase_23 AC 36 ms
52,392 KB
testcase_24 AC 34 ms
52,068 KB
testcase_25 AC 34 ms
52,820 KB
testcase_26 AC 36 ms
52,380 KB
testcase_27 AC 36 ms
52,992 KB
testcase_28 AC 36 ms
53,472 KB
testcase_29 AC 36 ms
52,328 KB
testcase_30 AC 782 ms
62,788 KB
testcase_31 AC 805 ms
63,388 KB
testcase_32 AC 780 ms
62,936 KB
testcase_33 AC 789 ms
63,972 KB
testcase_34 AC 799 ms
62,288 KB
testcase_35 AC 54 ms
61,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

n = int(input())
m = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
mod = 1_000_000_007

ans = 0
for a in A:
    if(a==0):
        continue
    for b in B:
        gcd_num = gcd(a,b)
        ans += (a*(b+1))%mod - (b-gcd_num)
        ans %= mod

print(ans)
0