結果
| 問題 |
No.849 yuki国の分割統治
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 23:07:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 753 bytes |
| コンパイル時間 | 438 ms |
| コンパイル使用メモリ | 81,404 KB |
| 実行使用メモリ | 105,972 KB |
| 最終ジャッジ日時 | 2025-04-15 23:09:45 |
| 合計ジャッジ時間 | 4,748 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 WA * 1 |
ソースコード
a, b, c, d = map(int, input().split())
D = a * d - b * c
N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
from collections import defaultdict
counter = defaultdict(int)
if D != 0:
mod = abs(D)
for x, y in points:
val1 = (d * x - c * y) % mod
val2 = (-b * x + a * y) % mod
counter[(val1, val2)] += 1
else:
if a == 0 and b != 0:
mod = b
for x, y in points:
ry = y % mod
counter[(x, ry)] += 1
elif b == 0 and a != 0:
mod = a
for x, y in points:
rx = x % mod
counter[(y, rx)] += 1
else:
for x, y in points:
param = b * x - a * y
counter[param] += 1
print(len(counter))
lam6er