結果
問題 | No.947 ABC包囲網 |
ユーザー | titia |
提出日時 | 2019-12-10 02:59:05 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 924 bytes |
コンパイル時間 | 78 ms |
コンパイル使用メモリ | 10,996 KB |
実行使用メモリ | 15,344 KB |
最終ジャッジ日時 | 2023-09-05 18:44:26 |
合計ジャッジ時間 | 5,416 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
14,376 KB |
testcase_01 | AC | 31 ms
9,820 KB |
testcase_02 | AC | 31 ms
9,788 KB |
testcase_03 | AC | 31 ms
9,804 KB |
testcase_04 | AC | 32 ms
9,756 KB |
testcase_05 | AC | 31 ms
9,768 KB |
testcase_06 | AC | 32 ms
9,872 KB |
testcase_07 | AC | 31 ms
9,820 KB |
testcase_08 | AC | 32 ms
9,756 KB |
testcase_09 | AC | 31 ms
9,976 KB |
testcase_10 | AC | 31 ms
9,816 KB |
testcase_11 | AC | 32 ms
9,772 KB |
testcase_12 | AC | 31 ms
9,948 KB |
testcase_13 | AC | 32 ms
9,772 KB |
testcase_14 | AC | 31 ms
9,996 KB |
testcase_15 | AC | 45 ms
9,796 KB |
testcase_16 | AC | 38 ms
9,864 KB |
testcase_17 | AC | 38 ms
9,884 KB |
testcase_18 | AC | 42 ms
10,012 KB |
testcase_19 | AC | 42 ms
9,844 KB |
testcase_20 | AC | 42 ms
9,764 KB |
testcase_21 | AC | 41 ms
9,924 KB |
testcase_22 | AC | 42 ms
10,036 KB |
testcase_23 | AC | 42 ms
9,860 KB |
testcase_24 | AC | 43 ms
9,820 KB |
testcase_25 | AC | 43 ms
9,796 KB |
testcase_26 | AC | 43 ms
9,888 KB |
testcase_27 | AC | 42 ms
9,792 KB |
testcase_28 | TLE | - |
testcase_29 | -- | - |
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 | -- | - |
ソースコード
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 BQL0=[0]*len(Q0) BQR0=[0]*len(Q0) for i in range(len(Q0)): BQL0[i]=bisect.bisect_left(Q1,Q0[i]) BQR0[i]=bisect.bisect_right(Q1,Q0[i]) for i in range(len(Q0)-1): for j in range(i+1,len(Q0)): ANS+=max(0,BQL0[j]-BQR0[i]) BQL1=[0]*len(Q1) BQR1=[0]*len(Q1) for i in range(len(Q1)): BQL1[i]=bisect.bisect_left(Q0,Q1[i]) BQR1[i]=bisect.bisect_right(Q0,Q1[i]) for i in range(len(Q1)-1): for j in range(i+1,len(Q1)): ANS+=max(0,BQL1[j]-BQR1[i]) print(ANS)