結果

問題 No.1201 お菓子配り-4
ユーザー mkawa2mkawa2
提出日時 2021-07-06 12:18:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 968 ms / 4,000 ms
コード長 824 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 87,408 KB
実行使用メモリ 76,968 KB
最終ジャッジ日時 2023-09-14 04:21:48
合計ジャッジ時間 13,886 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
76,132 KB
testcase_01 AC 508 ms
76,756 KB
testcase_02 AC 690 ms
76,956 KB
testcase_03 AC 372 ms
76,872 KB
testcase_04 AC 219 ms
76,724 KB
testcase_05 AC 439 ms
76,712 KB
testcase_06 AC 128 ms
76,372 KB
testcase_07 AC 243 ms
76,596 KB
testcase_08 AC 533 ms
76,796 KB
testcase_09 AC 413 ms
76,940 KB
testcase_10 AC 79 ms
76,908 KB
testcase_11 AC 163 ms
76,760 KB
testcase_12 AC 780 ms
76,896 KB
testcase_13 AC 92 ms
76,560 KB
testcase_14 AC 85 ms
76,080 KB
testcase_15 AC 625 ms
76,736 KB
testcase_16 AC 244 ms
76,688 KB
testcase_17 AC 290 ms
76,728 KB
testcase_18 AC 108 ms
76,896 KB
testcase_19 AC 107 ms
76,704 KB
testcase_20 AC 67 ms
71,552 KB
testcase_21 AC 70 ms
71,296 KB
testcase_22 AC 71 ms
71,164 KB
testcase_23 AC 72 ms
71,552 KB
testcase_24 AC 68 ms
71,372 KB
testcase_25 AC 68 ms
71,440 KB
testcase_26 AC 68 ms
71,368 KB
testcase_27 AC 66 ms
71,428 KB
testcase_28 AC 73 ms
71,528 KB
testcase_29 AC 71 ms
71,428 KB
testcase_30 AC 964 ms
76,804 KB
testcase_31 AC 965 ms
76,912 KB
testcase_32 AC 968 ms
76,596 KB
testcase_33 AC 964 ms
76,680 KB
testcase_34 AC 962 ms
76,968 KB
testcase_35 AC 272 ms
76,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0