結果
| 問題 |
No.2355 Unhappy Back Dance
|
| コンテスト | |
| ユーザー |
navel_tos
|
| 提出日時 | 2023-06-17 00:29:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,163 bytes |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 82,400 KB |
| 実行使用メモリ | 98,156 KB |
| 最終ジャッジ日時 | 2024-06-24 17:31:45 |
| 合計ジャッジ時間 | 13,048 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 28 WA * 9 |
ソースコード
#yukicoder393F
'''
aftercontest これ解けそう
N^2 * logN が間に合うだろ
'''
from fractions import Fraction as Fc
from collections import defaultdict as dd
f=lambda:tuple(map(int,input().split()))
#直線の切片のx座標y座標を返す
def line(P,Q):
x1,y1=P; x2,y2=Q
if x1==x2: return (x1,10**100)
R=Fc(y2-y1,x2-x1); return (R,-R*x1+y1)
N=int(input()); P=[f() for _ in range(N)]; ans=0
#各人に対して直線の式を計算する
for i in range(N):
D=dd(list); hantei=0
for j in range(N):
if i==j: continue
D[line(P[i],P[j])].append(j)
for k in D:
if len(D[k])==1: continue
if k[1]==10**100:
plus,minus=0,0
for now in D[k]:
if P[i][1]<P[now][1] and not plus: plus=1
elif P[i][1]>P[now][1] and not minus: minus=1
else: hantei=1; break
else:
plus,minus=0,0
for now in D[k]:
if P[i][0]<P[now][0] and not plus: plus=1
elif P[i][0]>P[now][0] and not minus: minus=1
else: hantei=1; break
ans+=hantei
if i==4: break
print(ans)
navel_tos