結果

問題 No.2355 Unhappy Back Dance
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-06-16 22:47:23
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,369 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 615,772 KB
最終ジャッジ日時 2023-09-06 21:24:28
合計ジャッジ時間 21,502 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,624 KB
testcase_01 AC 74 ms
71,424 KB
testcase_02 AC 77 ms
71,616 KB
testcase_03 AC 74 ms
71,136 KB
testcase_04 AC 73 ms
71,324 KB
testcase_05 AC 74 ms
71,332 KB
testcase_06 AC 410 ms
77,572 KB
testcase_07 AC 397 ms
77,484 KB
testcase_08 AC 460 ms
77,432 KB
testcase_09 AC 1,436 ms
77,712 KB
testcase_10 AC 2,237 ms
342,876 KB
testcase_11 AC 2,518 ms
346,340 KB
testcase_12 AC 471 ms
77,476 KB
testcase_13 AC 724 ms
77,628 KB
testcase_14 AC 2,476 ms
345,764 KB
testcase_15 AC 74 ms
71,488 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 2,269 ms
295,348 KB
testcase_22 AC 465 ms
120,852 KB
testcase_23 AC 487 ms
125,696 KB
testcase_24 MLE -
testcase_25 AC 2,744 ms
349,928 KB
testcase_26 AC 2,760 ms
350,144 KB
testcase_27 AC 2,362 ms
311,552 KB
testcase_28 AC 133 ms
81,716 KB
testcase_29 AC 194 ms
88,224 KB
testcase_30 AC 4,689 ms
497,864 KB
testcase_31 AC 3,396 ms
397,064 KB
testcase_32 AC 371 ms
111,088 KB
testcase_33 AC 1,936 ms
284,044 KB
testcase_34 AC 107 ms
78,556 KB
testcase_35 AC 135 ms
82,788 KB
testcase_36 AC 2,257 ms
311,548 KB
testcase_37 AC 1,241 ms
216,992 KB
testcase_38 AC 1,528 ms
253,516 KB
testcase_39 AC 1,196 ms
214,412 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(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*(10**18+1)+dc*(10**18+1)*(2*(10**18)+1)
            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