結果
問題 |
No.849 yuki国の分割統治
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:21:13 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 910 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 82,220 KB |
実行使用メモリ | 99,256 KB |
最終ジャッジ日時 | 2025-06-12 21:22:30 |
合計ジャッジ時間 | 4,509 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 WA * 15 |
ソースコード
import sys def main(): a, b, c, d = map(int, sys.stdin.readline().split()) N = int(sys.stdin.readline()) points = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)] D = a * d - b * c if D != 0: D_abs = abs(D) s = (b, -a) groups = set() for x, y in points: val = s[0] * x + s[1] * y mod_val = val % D_abs groups.add(mod_val) print(len(groups)) else: if (a == 0 and b == 0) or (c == 0 and d == 0): print(N) return if (a == 0 and c != 0) or (b == 0 and d != 0): groups = set() for x, y in points: groups.add(y) print(len(groups)) else: groups = set() for x, y in points: groups.add(y) print(len(groups)) if __name__ == "__main__": main()