結果

問題 No.2355 Unhappy Back Dance
ユーザー titiatitia
提出日時 2023-06-18 02:07:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,728 ms / 6,000 ms
コード長 1,100 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 90,172 KB
最終ジャッジ日時 2023-09-07 20:51:45
合計ジャッジ時間 31,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,276 KB
testcase_01 AC 68 ms
71,368 KB
testcase_02 AC 67 ms
71,200 KB
testcase_03 AC 69 ms
71,348 KB
testcase_04 AC 72 ms
71,164 KB
testcase_05 AC 71 ms
71,684 KB
testcase_06 AC 554 ms
84,232 KB
testcase_07 AC 562 ms
84,252 KB
testcase_08 AC 863 ms
84,808 KB
testcase_09 AC 852 ms
84,864 KB
testcase_10 AC 739 ms
85,308 KB
testcase_11 AC 728 ms
85,868 KB
testcase_12 AC 1,550 ms
84,972 KB
testcase_13 AC 1,648 ms
85,228 KB
testcase_14 AC 831 ms
86,152 KB
testcase_15 AC 72 ms
71,340 KB
testcase_16 AC 1,728 ms
89,320 KB
testcase_17 AC 1,641 ms
90,008 KB
testcase_18 AC 1,649 ms
90,052 KB
testcase_19 AC 1,693 ms
90,172 KB
testcase_20 AC 1,696 ms
89,620 KB
testcase_21 AC 769 ms
80,916 KB
testcase_22 AC 227 ms
77,644 KB
testcase_23 AC 226 ms
77,880 KB
testcase_24 AC 1,511 ms
89,012 KB
testcase_25 AC 840 ms
81,888 KB
testcase_26 AC 854 ms
81,912 KB
testcase_27 AC 747 ms
80,060 KB
testcase_28 AC 109 ms
77,644 KB
testcase_29 AC 127 ms
77,576 KB
testcase_30 AC 1,432 ms
85,996 KB
testcase_31 AC 1,081 ms
82,840 KB
testcase_32 AC 196 ms
77,624 KB
testcase_33 AC 611 ms
79,280 KB
testcase_34 AC 98 ms
77,496 KB
testcase_35 AC 104 ms
77,192 KB
testcase_36 AC 757 ms
79,904 KB
testcase_37 AC 436 ms
79,012 KB
testcase_38 AC 520 ms
78,900 KB
testcase_39 AC 442 ms
78,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from math import gcd
from operator import itemgetter

N=int(input())
XY=[list(map(int,input().split())) for i in range(N)]


def angle(a,b,c,d):
    x,y=a-c,b-d

    if x==0:
        return (0,1)
    if y==0:
        return (1,0)

    if x<0:
        x=-x
        y=-y

    g=abs(gcd(x,y))

    x//=g
    y//=g

    return (x,y)

        

USE=[0]*N

for i in range(N):
    D=dict()
    for j in range(N):
        if i==j:
            continue

        a,b=XY[i]
        c,d=XY[j]

        k=angle(a,b,c,d)

        if k in D:
            D[k].append(j)
        else:
            D[k]=[j]

    #print("!",D)

    for d in D:
        if len(D[d])<=1:
            continue

        LIST=[(XY[i][0],XY[i][1],i)]

        for d in D[d]:
            LIST.append((XY[d][0],XY[d][1],d))

        LIST.sort(key=itemgetter(0))
        LIST.sort(key=itemgetter(1))

        #print(d,LIST)

        for j in range(2,len(LIST)):
            USE[LIST[j][2]]=1

        for j in range(len(LIST)-3,-1,-1):
            USE[LIST[j][2]]=1

print(sum(USE))     
        
        
0