結果

問題 No.2355 Unhappy Back Dance
ユーザー navel_tosnavel_tos
提出日時 2023-06-17 00:33:14
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,321 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 87,344 KB
実行使用メモリ 269,816 KB
最終ジャッジ日時 2023-09-06 23:37:35
合計ジャッジ時間 38,277 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
89,840 KB
testcase_01 AC 208 ms
89,612 KB
testcase_02 AC 210 ms
89,660 KB
testcase_03 AC 210 ms
89,712 KB
testcase_04 AC 211 ms
89,592 KB
testcase_05 AC 219 ms
89,824 KB
testcase_06 AC 471 ms
92,192 KB
testcase_07 AC 2,433 ms
96,368 KB
testcase_08 AC 2,541 ms
95,924 KB
testcase_09 AC 2,586 ms
96,004 KB
testcase_10 AC 3,958 ms
208,860 KB
testcase_11 AC 5,090 ms
231,712 KB
testcase_12 AC 2,653 ms
96,428 KB
testcase_13 AC 2,639 ms
97,336 KB
testcase_14 AC 5,078 ms
246,972 KB
testcase_15 AC 214 ms
89,588 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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
        #高速化のため、関数化していた部分を解く
        x1,y1=P[i]; x2,y2=P[j]
        if x1==x2: D[(x1,10**100)].append(j)
        else:
            R=Fc(y2-y1,x2-x1); D[(R,-R*x1+y1)].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
print(ans)
0