結果

問題 No.461 三角形はいくつ?
ユーザー titiatitia
提出日時 2023-09-19 03:18:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 676 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 96,528 KB
最終ジャッジ日時 2023-09-19 03:19:03
合計ジャッジ時間 8,964 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 227 ms
89,068 KB
testcase_01 AC 229 ms
89,060 KB
testcase_02 AC 222 ms
89,104 KB
testcase_03 AC 219 ms
88,948 KB
testcase_04 AC 591 ms
96,528 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
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