結果

問題 No.2355 Unhappy Back Dance
ユーザー AngrySadEightAngrySadEight
提出日時 2023-04-13 01:45:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,135 ms / 6,000 ms
コード長 958 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 201,576 KB
最終ジャッジ日時 2024-04-18 19:14:46
合計ジャッジ時間 41,786 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,824 KB
testcase_01 AC 41 ms
52,912 KB
testcase_02 AC 43 ms
53,376 KB
testcase_03 AC 37 ms
52,612 KB
testcase_04 AC 37 ms
52,352 KB
testcase_05 AC 38 ms
53,724 KB
testcase_06 AC 438 ms
79,840 KB
testcase_07 AC 448 ms
79,860 KB
testcase_08 AC 522 ms
79,972 KB
testcase_09 AC 528 ms
79,924 KB
testcase_10 AC 967 ms
85,688 KB
testcase_11 AC 933 ms
94,028 KB
testcase_12 AC 538 ms
80,304 KB
testcase_13 AC 538 ms
80,088 KB
testcase_14 AC 1,142 ms
89,092 KB
testcase_15 AC 37 ms
52,740 KB
testcase_16 AC 3,076 ms
194,168 KB
testcase_17 AC 3,078 ms
192,104 KB
testcase_18 AC 3,135 ms
201,576 KB
testcase_19 AC 2,844 ms
169,936 KB
testcase_20 AC 3,076 ms
196,280 KB
testcase_21 AC 1,326 ms
108,060 KB
testcase_22 AC 335 ms
78,592 KB
testcase_23 AC 355 ms
79,208 KB
testcase_24 AC 2,837 ms
185,708 KB
testcase_25 AC 1,514 ms
118,732 KB
testcase_26 AC 1,549 ms
119,876 KB
testcase_27 AC 1,313 ms
108,468 KB
testcase_28 AC 128 ms
76,032 KB
testcase_29 AC 199 ms
77,248 KB
testcase_30 AC 2,333 ms
137,056 KB
testcase_31 AC 1,739 ms
117,920 KB
testcase_32 AC 287 ms
77,520 KB
testcase_33 AC 1,097 ms
99,188 KB
testcase_34 AC 108 ms
75,960 KB
testcase_35 AC 134 ms
76,460 KB
testcase_36 AC 1,290 ms
108,400 KB
testcase_37 AC 741 ms
87,624 KB
testcase_38 AC 902 ms
93,860 KB
testcase_39 AC 744 ms
89,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def my_gcd(a, b):
    if b == 0:
        return a
    else:
        return my_gcd(b, a % b)

N = int(input())
X = []
Y = []
for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
pos = [False for _ in range(N)]
for i in range(N):
    lst = []
    st = set()
    for j in range(N):
        if i == j:
            lst.append([-1, -1])
            continue
        dx = X[j] - X[i]
        dy = Y[j] - Y[i]
        if dx == 0:
            dy = dy // abs(dy)
        elif dy == 0:
            dx = dx // abs(dx)
        else:
            g = my_gcd(max(abs(dx), abs(dy)), min(abs(dx), abs(dy)))
            dx = dx // g
            dy = dy // g
        lst.append([dx, dy])
        st.add((dx, dy))
    for j in range(N):
        if i == j:
            continue
        lst2 = (lst[j][0] * -1, lst[j][1] * -1)
        if lst2 in st:
            pos[j] = True
ans = 0
for i in range(N):
    if pos[i]:
        ans += 1
print(ans)
0