結果

問題 No.2355 Unhappy Back Dance
ユーザー lloyz
提出日時 2023-06-24 14:28:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,217 ms / 6,000 ms
コード長 654 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 119,488 KB
最終ジャッジ日時 2024-07-01 17:06:36
合計ジャッジ時間 28,902 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import defaultdict

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)
0