結果
問題 |
No.849 yuki国の分割統治
|
ユーザー |
![]() |
提出日時 | 2025-04-15 23:09:54 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 442 ms |
コンパイル使用メモリ | 81,780 KB |
実行使用メモリ | 106,172 KB |
最終ジャッジ日時 | 2025-04-15 23:12:10 |
合計ジャッジ時間 | 5,789 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))