結果
| 問題 |
No.990 N×Mマス計算(Kの倍数)
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-05-06 06:09:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 489 bytes |
| コンパイル時間 | 276 ms |
| コンパイル使用メモリ | 82,328 KB |
| 実行使用メモリ | 115,348 KB |
| 最終ジャッジ日時 | 2024-09-13 23:27:58 |
| 合計ジャッジ時間 | 5,300 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 TLE * 1 -- * 8 |
ソースコード
n,m,k,op,*ab = open(0).read().split()
m,k = int(m),int(k)
from collections import Counter
from math import gcd
a = map(int,ab[:m])
b = [int(i)%k for i in ab[m:]]
if op == "+":
d = Counter(b)
print(sum(d[-ai%k] for ai in a))
exit()
r = []
for i in range(1,k+1):
if i*i > k: break
if k%i==0: r.append(i)
if i*i != k: r.append(k//i)
d = Counter(gcd(i,k) for i in b)
ans = 0
for ai in a:
for bi,v in d.items():
if ai*bi%k==0:
ans += v
print(ans)
convexineq