結果

問題 No.947 ABC包囲網
ユーザー titiatitia
提出日時 2019-12-10 02:18:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 744 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 99,260 KB
最終ジャッジ日時 2023-09-05 17:35:17
合計ジャッジ時間 18,120 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 233 ms
89,548 KB
testcase_01 AC 231 ms
89,624 KB
testcase_02 AC 233 ms
89,608 KB
testcase_03 AC 234 ms
89,512 KB
testcase_04 AC 234 ms
89,492 KB
testcase_05 AC 235 ms
89,656 KB
testcase_06 AC 237 ms
89,500 KB
testcase_07 AC 239 ms
89,524 KB
testcase_08 AC 236 ms
89,464 KB
testcase_09 AC 235 ms
89,324 KB
testcase_10 AC 237 ms
89,508 KB
testcase_11 AC 236 ms
89,492 KB
testcase_12 AC 243 ms
89,296 KB
testcase_13 AC 237 ms
89,488 KB
testcase_14 AC 237 ms
89,372 KB
testcase_15 AC 519 ms
95,896 KB
testcase_16 AC 396 ms
93,696 KB
testcase_17 AC 410 ms
94,148 KB
testcase_18 AC 400 ms
93,088 KB
testcase_19 AC 397 ms
93,184 KB
testcase_20 AC 388 ms
92,120 KB
testcase_21 AC 379 ms
92,088 KB
testcase_22 AC 406 ms
94,228 KB
testcase_23 AC 449 ms
94,444 KB
testcase_24 AC 441 ms
93,876 KB
testcase_25 AC 456 ms
96,068 KB
testcase_26 AC 449 ms
93,504 KB
testcase_27 AC 481 ms
94,708 KB
testcase_28 TLE -
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)]

Q=[]

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

    else:
        Q.append((0,Fraction(y,x)))
        
#print(Q)

Q.sort()

ANS=0
import bisect

for i in range(n-1):
    for j in range(i+1,n):

        if Q[i][0]==Q[j][0]:
            x=bisect.bisect_right(Q,(1-Q[i][0],Q[i][1]))
            y=bisect.bisect_left(Q,(1-Q[j][0],Q[j][1]))

            #print(i,j,x,y)
            ANS+=max(0,y-x)

        else:
            break
        
print(ANS)

            
0