結果
問題 | No.990 N×Mマス計算(Kの倍数) |
ユーザー |
![]() |
提出日時 | 2020-04-21 10:54:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 482 ms / 2,000 ms |
コード長 | 384 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 39,744 KB |
最終ジャッジ日時 | 2024-10-07 18:13:51 |
合計ジャッジ時間 | 3,801 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))