結果
| 問題 |
No.2355 Unhappy Back Dance
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:56:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,447 ms / 6,000 ms |
| コード長 | 1,060 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 82,536 KB |
| 実行使用メモリ | 82,600 KB |
| 最終ジャッジ日時 | 2025-03-20 18:58:25 |
| 合計ジャッジ時間 | 22,206 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
import sys
import math
def main():
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx += 1
points = []
for _ in range(N):
x = int(input[idx])
y = int(input[idx+1])
points.append((x, y))
idx += 2
result = 0
for i in range(N):
xi, yi = points[i]
dir_counts = {}
for j in range(N):
if i == j:
continue
xj, yj = points[j]
dx = xj - xi
dy = yj - yi
g = math.gcd(abs(dx), abs(dy))
if g == 0:
continue # Not possible as per problem constraints
reduced = (dx // g, dy // g)
if reduced in dir_counts:
dir_counts[reduced] += 1
else:
dir_counts[reduced] = 1
# Check if any direction has at least two points
for count in dir_counts.values():
if count >= 2:
result += 1
break
print(result)
if __name__ == '__main__':
main()
lam6er