結果

問題 No.990 N×Mマス計算(Kの倍数)
ユーザー convexineqconvexineq
提出日時 2021-05-06 06:29:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 331 bytes
コンパイル時間 878 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 132,312 KB
最終ジャッジ日時 2023-10-11 23:46:25
合計ジャッジ時間 4,500 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,920 KB
testcase_01 AC 95 ms
71,896 KB
testcase_02 AC 96 ms
71,496 KB
testcase_03 AC 96 ms
71,960 KB
testcase_04 AC 94 ms
71,688 KB
testcase_05 AC 95 ms
71,924 KB
testcase_06 AC 95 ms
71,728 KB
testcase_07 AC 96 ms
71,876 KB
testcase_08 AC 95 ms
71,560 KB
testcase_09 AC 93 ms
71,596 KB
testcase_10 AC 145 ms
94,472 KB
testcase_11 AC 148 ms
92,368 KB
testcase_12 AC 259 ms
107,852 KB
testcase_13 AC 132 ms
86,448 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 159 ms
99,768 KB
testcase_17 WA -
testcase_18 AC 257 ms
107,800 KB
testcase_19 AC 172 ms
92,476 KB
testcase_20 AC 214 ms
132,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter as C
from math import gcd
n,m,k,op,*ab = open(0).read().split()
m,k = int(m),int(k)
f = lambda x: int(x)%k if op=="+" else gcd(k,int(x))
a = C(map(f,ab[:m]))
b = C(map(f,ab[m:]))
print(sum(b[-i%k] for i,v in a.items()) if op == "+" else sum(v*w*(i*j%k==0) for j,w in b.items() for i,v in a.items()))
0