結果

問題 No.461 三角形はいくつ?
ユーザー titiatitia
提出日時 2023-09-19 03:19:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 676 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 19,036 KB
最終ジャッジ日時 2023-09-19 03:19:46
合計ジャッジ時間 24,384 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
19,036 KB
testcase_01 AC 23 ms
9,132 KB
testcase_02 AC 22 ms
9,076 KB
testcase_03 AC 22 ms
9,016 KB
testcase_04 AC 32 ms
9,076 KB
testcase_05 AC 2,457 ms
9,704 KB
testcase_06 AC 1,246 ms
9,516 KB
testcase_07 AC 1,616 ms
9,588 KB
testcase_08 AC 1,069 ms
9,520 KB
testcase_09 AC 25 ms
9,144 KB
testcase_10 AC 333 ms
9,332 KB
testcase_11 AC 1,735 ms
9,560 KB
testcase_12 AC 822 ms
9,452 KB
testcase_13 AC 2,554 ms
9,620 KB
testcase_14 AC 2,452 ms
9,608 KB
testcase_15 AC 2,536 ms
9,740 KB
testcase_16 AC 43 ms
9,888 KB
testcase_17 AC 44 ms
9,680 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from decimal import *
getcontext().prec = 30


from bisect import bisect_left

from math import gcd

L=[[0] for i in range(3)]

N=int(input())

for i in range(N):
    p,a,b=map(int,input().split())

    GCD=gcd(a,b)
    a//=GCD
    b//=GCD

    L[p].append(Decimal(b)/Decimal(a+b))

L[0].sort()
L[1].sort()
L[2].sort()

ANS=0

SET=set(L[2])

for x in L[0]:
    for y in L[1]:
        if x+y>1:
            break
        MAX=max(x,y)

        k=bisect_left(L[2],1-MAX)

        #print(x,y,L[2],k,1-MAX)

        ANS+=k

        z=x+y
        if z<1-MAX and 1-z in SET:
            #print(x,y,z)
            ANS-=1

print(ANS)


        

0