結果

問題 No.2355 Unhappy Back Dance
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-06-16 22:53:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,156 ms / 6,000 ms
コード長 1,417 bytes
コンパイル時間 1,381 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 265,988 KB
最終ジャッジ日時 2023-09-06 21:34:19
合計ジャッジ時間 45,448 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,472 KB
testcase_01 AC 72 ms
71,136 KB
testcase_02 AC 72 ms
71,380 KB
testcase_03 AC 72 ms
71,272 KB
testcase_04 AC 72 ms
71,148 KB
testcase_05 AC 70 ms
71,084 KB
testcase_06 AC 491 ms
80,056 KB
testcase_07 AC 448 ms
79,632 KB
testcase_08 AC 519 ms
79,880 KB
testcase_09 AC 1,486 ms
87,184 KB
testcase_10 AC 1,174 ms
103,936 KB
testcase_11 AC 1,252 ms
114,824 KB
testcase_12 AC 525 ms
80,452 KB
testcase_13 AC 792 ms
82,840 KB
testcase_14 AC 1,273 ms
111,108 KB
testcase_15 AC 72 ms
71,068 KB
testcase_16 AC 3,156 ms
265,988 KB
testcase_17 AC 2,960 ms
250,604 KB
testcase_18 AC 3,090 ms
247,532 KB
testcase_19 AC 2,948 ms
214,940 KB
testcase_20 AC 2,985 ms
220,904 KB
testcase_21 AC 1,292 ms
128,432 KB
testcase_22 AC 307 ms
79,164 KB
testcase_23 AC 322 ms
80,188 KB
testcase_24 AC 2,760 ms
221,632 KB
testcase_25 AC 1,522 ms
148,320 KB
testcase_26 AC 1,555 ms
136,164 KB
testcase_27 AC 1,331 ms
138,172 KB
testcase_28 AC 113 ms
76,996 KB
testcase_29 AC 153 ms
77,220 KB
testcase_30 AC 2,518 ms
231,124 KB
testcase_31 AC 1,876 ms
176,908 KB
testcase_32 AC 269 ms
78,816 KB
testcase_33 AC 1,096 ms
111,988 KB
testcase_34 AC 98 ms
77,044 KB
testcase_35 AC 114 ms
77,048 KB
testcase_36 AC 1,292 ms
135,860 KB
testcase_37 AC 735 ms
94,504 KB
testcase_38 AC 891 ms
105,420 KB
testcase_39 AC 709 ms
95,776 KB
権限があれば一括ダウンロードができます

ソースコード

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()
    uh=[0]*n
    for i in range(n):
        mp=dict()
        for j in range(n):
            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*(10**18+1)+dc*(10**18+1)*(2*(10**18)+1)
            if not ad in mp:
                mp[ad]=set()
            mp[ad].add(j)
        for vc in mp.values():
            if len(vc) < 2:
                continue
            if len(vc) > 2:
                for v in vc:
                    uh[v]|=1
                continue
            vl=list(vc)
            vl.append(i)
            for j in range(3):
                inner = (x[vl[(j+2)%3]]-x[vl[j]])*(x[vl[(j+1)%3]]-x[vl[j]])+(y[vl[(j+2)%3]]-y[vl[j]])*(y[vl[(j+1)%3]]-y[vl[j]])
                if inner > 0:
                    uh[vl[j]]|=1
    print(sum(uh))

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