結果
問題 | No.1201 お菓子配り-4 |
ユーザー |
|
提出日時 | 2020-08-28 22:57:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 895 ms / 4,000 ms |
コード長 | 342 bytes |
コンパイル時間 | 417 ms |
コンパイル使用メモリ | 82,500 KB |
実行使用メモリ | 62,188 KB |
最終ジャッジ日時 | 2024-11-14 01:50:26 |
合計ジャッジ時間 | 11,927 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
from math import gcddef solve():mod = 10**9+7N = int(input())M = int(input())A = list(map(int, input().split()))B = list(map(int, input().split()))ans = (sum(B)+M)*sum(A)%modfor a in A:for b in B:g = gcd(a,b)ans -= (b//g)*(b//g-1)*g*g//breturn ans%modprint(solve())