結果

問題 No.461 三角形はいくつ?
ユーザー ヒッキープログラミングするスレ GitHub ガチヒッキープログラミングするスレ GitHub ガチ
提出日時 2016-12-12 04:07:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 637 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 99,064 KB
最終ジャッジ日時 2023-08-19 19:24:42
合計ジャッジ時間 33,181 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
89,696 KB
testcase_01 AC 199 ms
89,452 KB
testcase_02 AC 193 ms
89,460 KB
testcase_03 AC 196 ms
89,588 KB
testcase_04 AC 274 ms
92,600 KB
testcase_05 AC 3,243 ms
93,924 KB
testcase_06 AC 1,884 ms
94,916 KB
testcase_07 AC 2,139 ms
95,632 KB
testcase_08 AC 1,529 ms
95,584 KB
testcase_09 AC 238 ms
91,276 KB
testcase_10 AC 674 ms
94,012 KB
testcase_11 AC 2,391 ms
93,728 KB
testcase_12 AC 1,243 ms
93,840 KB
testcase_13 AC 3,513 ms
93,448 KB
testcase_14 AC 3,348 ms
94,220 KB
testcase_15 AC 3,444 ms
93,796 KB
testcase_16 AC 319 ms
93,800 KB
testcase_17 AC 304 ms
93,592 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 #

from fractions import Fraction
from bisect import bisect_left

one = Fraction(1)

n = int(input())

ps = [[one], [one], [one]]

for _ in range(n):
    p, a, b = map(int, input().split())
    ps[p].append(Fraction(a, a + b))

p0, p1, p2 = sorted(map(sorted, ps), key=len)

p1len = len(p1)
p2len = len(p2)

ans = 0
for x in p0:
    for c in range(bisect_left(p1, one - x) , p1len):
        y = p1[c]
        i = bisect_left(p2, one - min(x, y))
        ans += p2len - i - 1
        if x != one - y:
            r = (one - x) + (one - y)
            j = bisect_left(p2, r, i)
            if p2[j] != r:
                ans += 1

print(ans)
0