結果
| 問題 |
No.849 yuki国の分割統治
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:30:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 910 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 82,336 KB |
| 実行使用メモリ | 99,360 KB |
| 最終ジャッジ日時 | 2025-06-12 16:31:07 |
| 合計ジャッジ時間 | 4,520 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()
gew1fw