結果

問題 No.990 N×Mマス計算(Kの倍数)
ユーザー convexineqconvexineq
提出日時 2021-05-06 06:09:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 489 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 110,320 KB
最終ジャッジ日時 2023-10-11 23:30:09
合計ジャッジ時間 6,767 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
75,788 KB
testcase_01 AC 94 ms
71,736 KB
testcase_02 AC 95 ms
71,624 KB
testcase_03 AC 95 ms
71,916 KB
testcase_04 AC 105 ms
77,224 KB
testcase_05 AC 96 ms
71,572 KB
testcase_06 AC 96 ms
71,508 KB
testcase_07 AC 94 ms
71,620 KB
testcase_08 AC 95 ms
71,936 KB
testcase_09 AC 96 ms
71,372 KB
testcase_10 AC 133 ms
85,724 KB
testcase_11 AC 144 ms
92,396 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0