結果
問題 | No.461 三角形はいくつ? |
ユーザー | ヒッキープログラミングするスレ GitHub ガチ |
提出日時 | 2016-12-12 02:04:26 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 969 bytes |
コンパイル時間 | 2,936 ms |
コンパイル使用メモリ | 86,460 KB |
実行使用メモリ | 99,296 KB |
最終ジャッジ日時 | 2023-08-19 18:03:01 |
合計ジャッジ時間 | 39,958 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 212 ms
89,512 KB |
testcase_01 | AC | 210 ms
89,412 KB |
testcase_02 | AC | 209 ms
89,412 KB |
testcase_03 | AC | 211 ms
89,336 KB |
testcase_04 | AC | 354 ms
92,920 KB |
testcase_05 | AC | 3,838 ms
98,032 KB |
testcase_06 | AC | 2,195 ms
96,204 KB |
testcase_07 | AC | 2,626 ms
96,780 KB |
testcase_08 | AC | 1,907 ms
95,196 KB |
testcase_09 | AC | 288 ms
91,280 KB |
testcase_10 | AC | 893 ms
95,856 KB |
testcase_11 | AC | 3,057 ms
95,896 KB |
testcase_12 | AC | 1,590 ms
96,300 KB |
testcase_13 | AC | 4,146 ms
96,408 KB |
testcase_14 | AC | 4,055 ms
97,540 KB |
testcase_15 | AC | 4,194 ms
99,296 KB |
testcase_16 | AC | 358 ms
92,172 KB |
testcase_17 | AC | 357 ms
92,332 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 | -- | - |
ソースコード
from fractions import Fraction from bisect import bisect_left n = int(input()) ps = [[Fraction(1)], [Fraction(1)], [Fraction(1)]] for _ in range(n): p, a, b = map(int, input().split()) ps[p].append(Fraction(a, a + b)) ps = list(map(sorted, ps)) ans = 0 for x in ps[0]: t = bisect_left(ps[1], Fraction(1) - x) for c in range(t, len(ps[1])): y = ps[1][c] mn, mx = (x, y) if x < y else (y, x) k = Fraction(1) - mn i = bisect_left(ps[2], k) ans += len(ps[2]) - i if mn > Fraction(1, 2): r = (Fraction(1) - mn) + (Fraction(1) - mx) j = bisect_left(ps[2], r, i) if ps[2][j] == r: ans -= 1 elif mn == Fraction(1) - mx: ans -= 1 elif mn != mx: r = mn - (Fraction(1) - mx) j = bisect_left(ps[2], r, i) if ps[2][j] == r: ans -= 1 else: ans -= 1 print(ans)