結果

問題 No.2355 Unhappy Back Dance
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-06-16 22:50:03
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,370 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 598,016 KB
最終ジャッジ日時 2023-09-06 21:27:19
合計ジャッジ時間 38,267 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,496 KB
testcase_01 AC 65 ms
71,588 KB
testcase_02 AC 70 ms
71,528 KB
testcase_03 AC 67 ms
71,660 KB
testcase_04 AC 64 ms
71,620 KB
testcase_05 AC 66 ms
71,456 KB
testcase_06 AC 225 ms
77,660 KB
testcase_07 AC 208 ms
77,492 KB
testcase_08 AC 247 ms
77,548 KB
testcase_09 AC 704 ms
77,716 KB
testcase_10 AC 1,076 ms
342,948 KB
testcase_11 AC 1,215 ms
346,060 KB
testcase_12 AC 266 ms
77,720 KB
testcase_13 AC 407 ms
77,744 KB
testcase_14 AC 1,124 ms
343,304 KB
testcase_15 AC 65 ms
71,392 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 1,085 ms
294,044 KB
testcase_22 AC 238 ms
114,164 KB
testcase_23 AC 254 ms
122,100 KB
testcase_24 MLE -
testcase_25 AC 1,235 ms
339,440 KB
testcase_26 AC 1,311 ms
353,756 KB
testcase_27 AC 1,117 ms
307,044 KB
testcase_28 AC 97 ms
80,016 KB
testcase_29 AC 128 ms
86,660 KB
testcase_30 AC 2,256 ms
497,220 KB
testcase_31 AC 1,651 ms
383,944 KB
testcase_32 AC 199 ms
108,060 KB
testcase_33 AC 915 ms
286,772 KB
testcase_34 AC 82 ms
76,356 KB
testcase_35 AC 100 ms
80,372 KB
testcase_36 AC 1,109 ms
306,784 KB
testcase_37 AC 575 ms
212,304 KB
testcase_38 AC 700 ms
247,724 KB
testcase_39 AC 564 ms
207,296 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()
    mp=dict()
    for i in range(n):
        for j in range(i+1,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(i)
            mp[ad].add(j)
    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