結果

問題 No.990 N×Mマス計算(Kの倍数)
ユーザー convexineqconvexineq
提出日時 2021-05-06 07:55:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 129,416 KB
最終ジャッジ日時 2023-10-12 00:58:31
合計ジャッジ時間 4,786 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
71,580 KB
testcase_01 AC 95 ms
71,788 KB
testcase_02 AC 95 ms
71,644 KB
testcase_03 AC 96 ms
71,964 KB
testcase_04 AC 96 ms
71,480 KB
testcase_05 AC 95 ms
71,660 KB
testcase_06 AC 96 ms
71,748 KB
testcase_07 AC 97 ms
71,872 KB
testcase_08 AC 97 ms
71,848 KB
testcase_09 AC 95 ms
71,528 KB
testcase_10 AC 203 ms
103,968 KB
testcase_11 AC 166 ms
106,332 KB
testcase_12 AC 278 ms
126,732 KB
testcase_13 AC 142 ms
94,792 KB
testcase_14 AC 194 ms
114,792 KB
testcase_15 AC 151 ms
97,172 KB
testcase_16 AC 201 ms
116,800 KB
testcase_17 AC 140 ms
90,816 KB
testcase_18 AC 278 ms
126,772 KB
testcase_19 AC 183 ms
103,100 KB
testcase_20 AC 259 ms
129,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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