結果
| 問題 |
No.2355 Unhappy Back Dance
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-24 14:28:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 2,195 ms / 6,000 ms |
| コード長 | 692 bytes |
| コンパイル時間 | 190 ms |
| コンパイル使用メモリ | 82,276 KB |
| 実行使用メモリ | 119,528 KB |
| 最終ジャッジ日時 | 2024-07-01 17:07:21 |
| 合計ジャッジ時間 | 28,110 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
from math import gcd
from collections import defaultdict
import sys
input = sys.stdin.readline
n = int(input())
P = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
xi, yi = P[i]
counter = defaultdict(int)
flag = False
for j in range(n):
if i == j:
continue
xj, yj = P[j]
dx, dy = abs(xi - xj), abs(yi - yj)
gcd_ = gcd(dx, dy)
dx, dy = dx // gcd_, dy // gcd_
plus_x = (xj >= xi)
plus_y = (yj >= yi)
counter[dx, dy, plus_x, plus_y] += 1
if counter[dx, dy, plus_x, plus_y] == 2:
flag = True
break
if flag:
ans += 1
print(ans)