結果
| 問題 | No.990 N×Mマス計算(Kの倍数) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-19 03:33:03 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 77 ms |
| コンパイル使用メモリ | 80,640 KB |
| 実行使用メモリ | 292,604 KB |
| 最終ジャッジ日時 | 2026-09-16 04:43:56 |
| 合計ジャッジ時間 | 8,155 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 TLE * 1 -- * 8 |
ソースコード
from collections import defaultdict
import math
n, m, k = map(int, input().split())
op, *b = list(input().split())
cnt = defaultdict(int)
ans = 0
if op == "+":
for x in b:
cnt[int(x) % k] += 1
for _ in range(n):
ai = int(input())
ans += cnt[(- ai) % k]
elif op == "*":
for x in b:
x = int(x)
for d in range(1, int(math.sqrt(x)) + 1):
if x % d == 0:
if d != x // d:
cnt[x // d] += 1
cnt[d] += 1
for _ in range(n):
ai = int(input())
x = k // math.gcd(ai, k)
ans += cnt[x]
print(ans)