結果

問題 No.947 ABC包囲網
ユーザー titiatitia
提出日時 2019-12-10 02:17:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 747 bytes
コンパイル時間 1,065 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 97,148 KB
最終ジャッジ日時 2023-09-05 17:33:34
合計ジャッジ時間 15,908 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 264 ms
96,860 KB
testcase_01 AC 229 ms
89,664 KB
testcase_02 AC 238 ms
89,424 KB
testcase_03 AC 232 ms
89,760 KB
testcase_04 AC 228 ms
89,744 KB
testcase_05 AC 226 ms
89,712 KB
testcase_06 AC 231 ms
89,544 KB
testcase_07 AC 231 ms
89,752 KB
testcase_08 AC 228 ms
89,656 KB
testcase_09 AC 231 ms
89,600 KB
testcase_10 AC 231 ms
89,616 KB
testcase_11 AC 231 ms
89,708 KB
testcase_12 AC 231 ms
89,652 KB
testcase_13 AC 229 ms
89,660 KB
testcase_14 AC 230 ms
89,432 KB
testcase_15 AC 531 ms
95,560 KB
testcase_16 AC 395 ms
92,668 KB
testcase_17 AC 418 ms
94,732 KB
testcase_18 AC 396 ms
93,684 KB
testcase_19 AC 393 ms
93,304 KB
testcase_20 AC 383 ms
92,012 KB
testcase_21 AC 370 ms
92,368 KB
testcase_22 AC 395 ms
94,436 KB
testcase_23 AC 433 ms
94,340 KB
testcase_24 AC 426 ms
93,472 KB
testcase_25 AC 439 ms
94,992 KB
testcase_26 AC 464 ms
95,736 KB
testcase_27 AC 478 ms
94,416 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:
            continue
        
print(ANS)

            
0