結果
問題 |
No.990 N×Mマス計算(Kの倍数)
|
ユーザー |
![]() |
提出日時 | 2020-02-16 13:50:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 530 ms / 2,000 ms |
コード長 | 383 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 39,656 KB |
最終ジャッジ日時 | 2024-11-16 02:28:37 |
合計ジャッジ時間 | 4,191 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
import sys, math from collections import Counter n, m, k = map(int, input().split()) op, *B = input().split() ca = Counter({"+":int(a)%k, "*":math.gcd(int(a), k)}[op] for a in sys.stdin) cb = Counter({"+":-int(b)%k, "*":math.gcd(int(b), k)}[op] for b in B) if op=="+": print(sum(ca[i]*cb[i] for i in ca if i in cb)) else: print(sum(ca[i]*cb[j] for i in ca for j in cb if i*j%k==0))