結果

問題 No.947 ABC包囲網
ユーザー titiatitia
提出日時 2019-12-10 02:24:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 737 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 95,208 KB
最終ジャッジ日時 2023-09-05 17:41:36
合計ジャッジ時間 14,288 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 236 ms
93,896 KB
testcase_01 AC 235 ms
89,296 KB
testcase_02 AC 240 ms
89,196 KB
testcase_03 AC 242 ms
89,100 KB
testcase_04 AC 240 ms
89,240 KB
testcase_05 AC 243 ms
89,064 KB
testcase_06 AC 239 ms
89,200 KB
testcase_07 AC 239 ms
89,332 KB
testcase_08 AC 239 ms
89,172 KB
testcase_09 AC 236 ms
88,996 KB
testcase_10 AC 236 ms
89,388 KB
testcase_11 AC 236 ms
89,324 KB
testcase_12 AC 242 ms
89,232 KB
testcase_13 AC 238 ms
89,296 KB
testcase_14 AC 241 ms
89,072 KB
testcase_15 AC 463 ms
94,872 KB
testcase_16 AC 331 ms
93,696 KB
testcase_17 AC 373 ms
93,468 KB
testcase_18 AC 381 ms
92,340 KB
testcase_19 AC 378 ms
92,072 KB
testcase_20 AC 370 ms
91,760 KB
testcase_21 AC 367 ms
92,080 KB
testcase_22 AC 373 ms
92,676 KB
testcase_23 AC 401 ms
95,208 KB
testcase_24 AC 396 ms
93,524 KB
testcase_25 AC 420 ms
93,908 KB
testcase_26 AC 409 ms
92,312 KB
testcase_27 AC 393 ms
93,188 KB
testcase_28 AC 329 ms
92,112 KB
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from fractions import Fraction
import sys
input = sys.stdin.readline

n=int(input())
P=[tuple(map(int,input().split())) for i in range(n)]

Q0=[]
Q1=[]

for x,y in P:
    if x>0:
        Q1.append(Fraction(y,x))
    elif x==0:
        if y>0:
            Q1.append(float("inf"))
        else:
            Q0.append(float("inf"))

    else:
        Q0.append(Fraction(y,x))
        
Q0.sort()
Q1.sort()

ANS=0
import bisect

for i in range(len(Q0)-1):
    for j in range(i+1,len(Q0)):
        ANS+=max(0,bisect.bisect_left(Q1,Q0[j])-bisect.bisect_right(Q1,Q0[i]))

for i in range(len(Q1)-1):
    for j in range(i+1,len(Q1)):
        ANS+=max(0,bisect.bisect_left(Q0,Q1[j])-bisect.bisect_right(Q0,Q1[i]))
        
print(ANS)

            
0