結果

問題 No.1201 お菓子配り-4
ユーザー chineristACchineristAC
提出日時 2020-08-28 22:00:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 818 ms / 4,000 ms
コード長 326 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 63,488 KB
最終ジャッジ日時 2024-04-26 13:01:29
合計ジャッジ時間 11,495 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
60,416 KB
testcase_01 AC 415 ms
62,848 KB
testcase_02 AC 585 ms
62,976 KB
testcase_03 AC 309 ms
62,976 KB
testcase_04 AC 167 ms
61,312 KB
testcase_05 AC 352 ms
62,848 KB
testcase_06 AC 93 ms
60,416 KB
testcase_07 AC 188 ms
61,056 KB
testcase_08 AC 439 ms
62,720 KB
testcase_09 AC 329 ms
62,592 KB
testcase_10 AC 54 ms
61,568 KB
testcase_11 AC 119 ms
61,056 KB
testcase_12 AC 633 ms
62,848 KB
testcase_13 AC 68 ms
60,928 KB
testcase_14 AC 57 ms
59,392 KB
testcase_15 AC 513 ms
62,720 KB
testcase_16 AC 191 ms
62,976 KB
testcase_17 AC 228 ms
61,440 KB
testcase_18 AC 80 ms
61,824 KB
testcase_19 AC 74 ms
61,440 KB
testcase_20 AC 38 ms
52,096 KB
testcase_21 AC 39 ms
52,096 KB
testcase_22 AC 39 ms
51,968 KB
testcase_23 AC 41 ms
52,096 KB
testcase_24 AC 41 ms
51,968 KB
testcase_25 AC 44 ms
52,096 KB
testcase_26 AC 41 ms
51,712 KB
testcase_27 AC 42 ms
51,968 KB
testcase_28 AC 37 ms
52,224 KB
testcase_29 AC 38 ms
52,480 KB
testcase_30 AC 777 ms
62,976 KB
testcase_31 AC 778 ms
63,488 KB
testcase_32 AC 789 ms
63,104 KB
testcase_33 AC 818 ms
63,232 KB
testcase_34 AC 809 ms
62,976 KB
testcase_35 AC 254 ms
62,976 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 = 10**9+7
res = 0

for j in range(M):
    for i in range(N):
        g = gcd(A[i],B[j])

        res += A[i] * (B[j]+1)
        res %= mod

        res -= (B[j]-g)
        res %= mod

print(res)
0