結果

問題 No.461 三角形はいくつ?
ユーザー titiatitia
提出日時 2023-09-19 03:09:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 654 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 98,724 KB
最終ジャッジ日時 2023-09-19 03:10:36
合計ジャッジ時間 36,704 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 252 ms
96,888 KB
testcase_01 AC 250 ms
89,744 KB
testcase_02 AC 248 ms
89,680 KB
testcase_03 AC 252 ms
89,536 KB
testcase_04 AC 395 ms
92,144 KB
testcase_05 AC 3,474 ms
98,484 KB
testcase_06 AC 2,132 ms
97,888 KB
testcase_07 AC 2,291 ms
95,212 KB
testcase_08 AC 1,755 ms
96,140 KB
testcase_09 AC 341 ms
91,976 KB
testcase_10 AC 973 ms
97,260 KB
testcase_11 AC 2,638 ms
95,176 KB
testcase_12 AC 1,420 ms
94,392 KB
testcase_13 AC 3,689 ms
98,344 KB
testcase_14 AC 3,528 ms
94,300 KB
testcase_15 AC 3,690 ms
98,724 KB
testcase_16 AC 401 ms
93,808 KB
testcase_17 AC 403 ms
93,564 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 fractions import Fraction

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(Fraction(b,(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