結果

問題 No.2355 Unhappy Back Dance
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-06-16 22:37:01
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,331 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 688,092 KB
最終ジャッジ日時 2023-09-06 20:59:59
合計ジャッジ時間 24,724 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 65 ms
71,556 KB
testcase_02 AC 62 ms
71,332 KB
testcase_03 AC 68 ms
71,532 KB
testcase_04 AC 64 ms
71,468 KB
testcase_05 AC 63 ms
71,360 KB
testcase_06 AC 965 ms
77,964 KB
testcase_07 AC 936 ms
77,960 KB
testcase_08 AC 1,062 ms
78,228 KB
testcase_09 AC 2,086 ms
78,308 KB
testcase_10 AC 2,519 ms
362,248 KB
testcase_11 AC 2,837 ms
361,796 KB
testcase_12 AC 1,062 ms
77,800 KB
testcase_13 AC 1,156 ms
78,084 KB
testcase_14 AC 2,624 ms
361,672 KB
testcase_15 AC 65 ms
71,332 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 #

import sys
import math
input = sys.stdin.readline
def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for _ in range(N)]

def main():
    n=int(input())
    x=[0]*n
    y=[0]*n
    for i in range(n):
        x[i],y[i]=read_values()
    mp=dict()
    for i in range(n):
        for j in range(n):
            if i==j:continue
            dx=y[i]-y[j]
            dy=-x[i]+x[j]
            dc=-(dx*x[i]+dy*y[i])
            g=math.gcd(dx,dy,dc)
            if dx<0 or (dx==0 and dy<0):
                g*=-1
            if g==0:
                continue
            dx/=g
            dy/=g
            dc/=g
            ad=(dx,dy,dc)
            if not ad in mp:
                mp[ad]=set()
            mp[ad].add(i)
    uh=[0]*n
    for vc in mp.values():
        if len(vc) < 3:
            continue
        if len(vc) > 3:
            for v in vc:
                uh[v]|=1
            continue
        vl=list(vc)
        for i in range(3):
            inner = (x[vl[(i+2)%3]]-x[vl[i]])*(x[vl[(i+1)%3]]-x[vl[i]])+(y[vl[(i+2)%3]]-y[vl[i]])*(y[vl[(i+1)%3]]-y[vl[i]])
            if inner > 0:
                uh[vl[i]]|=1
    print(sum(uh))

if __name__ == "__main__":
    main()
0