結果
| 問題 |
No.1201 お菓子配り-4
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2021-07-06 12:18:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 833 ms / 4,000 ms |
| コード長 | 824 bytes |
| コンパイル時間 | 885 ms |
| コンパイル使用メモリ | 82,112 KB |
| 実行使用メモリ | 63,776 KB |
| 最終ジャッジ日時 | 2024-07-01 12:07:51 |
| 合計ジャッジ時間 | 11,296 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
import sys
# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7
from math import gcd
n = II()
m = II()
aa = LI()
bb = LI()
ans = 0
for a in aa:
for b in bb:
s = (a+1)*(b+1)
t = gcd(a, b)+1
ans += ((s+t)//2-b-1)*2
ans %= md
print(ans)
mkawa2