結果

問題 No.2207 pCr検査
ユーザー 👑 tatyamtatyam
提出日時 2022-07-13 00:01:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 135,844 KB
最終ジャッジ日時 2023-09-15 16:05:00
合計ジャッジ時間 18,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,576 KB
testcase_01 AC 71 ms
71,420 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 501 ms
106,408 KB
testcase_13 AC 335 ms
96,044 KB
testcase_14 AC 154 ms
82,236 KB
testcase_15 AC 495 ms
98,128 KB
testcase_16 AC 315 ms
94,540 KB
testcase_17 AC 435 ms
97,940 KB
testcase_18 AC 316 ms
86,160 KB
testcase_19 AC 240 ms
88,728 KB
testcase_20 AC 268 ms
84,724 KB
testcase_21 AC 596 ms
113,348 KB
testcase_22 AC 756 ms
135,844 KB
testcase_23 AC 757 ms
135,796 KB
testcase_24 AC 144 ms
79,060 KB
testcase_25 AC 299 ms
92,496 KB
testcase_26 AC 261 ms
86,496 KB
testcase_27 AC 396 ms
90,832 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
input = sys.stdin.readline

k = int(input())
N = [tuple(map(int, input().split())) for _ in range(k)]
lgN = sum(math.log(p) * e for p, e in N)
p = N[-1][0]
lg_plus = 0.0
lg_minus = 0.0
err = math.inf
r_ans = -1
for r in range(p // 2):
    lg_plus += math.log(p - r)
    lg_minus += math.log(r + 1)
    if err > abs(lg_minus + lgN - lg_plus):
        err = abs(lg_minus + lgN - lg_plus)
        r_ans = r + 1

if err < 1e-10:
    print(p, r_ans)
else:
    print(-1, -1)
0