結果

問題 No.990 N×Mマス計算(Kの倍数)
ユーザー convexineqconvexineq
提出日時 2021-05-06 06:30:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 132,156 KB
最終ジャッジ日時 2023-10-11 23:47:15
合計ジャッジ時間 4,451 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,896 KB
testcase_01 AC 100 ms
71,672 KB
testcase_02 AC 95 ms
71,824 KB
testcase_03 AC 94 ms
71,960 KB
testcase_04 AC 94 ms
71,684 KB
testcase_05 AC 95 ms
71,608 KB
testcase_06 AC 95 ms
71,724 KB
testcase_07 AC 97 ms
71,776 KB
testcase_08 AC 96 ms
71,632 KB
testcase_09 AC 97 ms
71,956 KB
testcase_10 AC 147 ms
94,612 KB
testcase_11 AC 151 ms
92,424 KB
testcase_12 AC 262 ms
107,552 KB
testcase_13 AC 137 ms
86,420 KB
testcase_14 AC 153 ms
94,532 KB
testcase_15 AC 129 ms
87,896 KB
testcase_16 AC 158 ms
99,804 KB
testcase_17 AC 127 ms
84,712 KB
testcase_18 AC 261 ms
107,812 KB
testcase_19 AC 171 ms
92,528 KB
testcase_20 AC 210 ms
132,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter as C
import math
n,m,k,op,*ab = open(0).read().split()
m,k = int(m),int(k)
f = lambda x: int(x)%k if op=="+" else math.gcd(k,int(x))
a = C(map(f,ab[:m]))
b = C(map(f,ab[m:]))
print(sum(v*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