結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,424 KB
testcase_01 AC 79 ms
71,580 KB
testcase_02 AC 744 ms
105,064 KB
testcase_03 AC 510 ms
97,660 KB
testcase_04 AC 572 ms
97,292 KB
testcase_05 AC 786 ms
112,724 KB
testcase_06 AC 520 ms
87,220 KB
testcase_07 AC 436 ms
91,612 KB
testcase_08 AC 328 ms
88,776 KB
testcase_09 AC 646 ms
104,880 KB
testcase_10 AC 320 ms
79,328 KB
testcase_11 AC 607 ms
102,484 KB
testcase_12 AC 600 ms
106,684 KB
testcase_13 AC 403 ms
95,772 KB
testcase_14 AC 175 ms
82,228 KB
testcase_15 AC 594 ms
98,328 KB
testcase_16 AC 379 ms
94,860 KB
testcase_17 AC 516 ms
97,732 KB
testcase_18 AC 375 ms
86,140 KB
testcase_19 AC 279 ms
88,816 KB
testcase_20 AC 314 ms
84,840 KB
testcase_21 AC 703 ms
113,336 KB
testcase_22 AC 893 ms
135,940 KB
testcase_23 AC 897 ms
135,632 KB
testcase_24 AC 179 ms
79,340 KB
testcase_25 AC 391 ms
92,964 KB
testcase_26 AC 331 ms
87,156 KB
testcase_27 AC 516 ms
91,056 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 = -1
for i in range(P // 2):
    lg_plus += math.log(P - i)
    lg_minus += math.log(i + 1)
    if err > abs(lgN - lg_plus + lg_minus):
        err = abs(lgN - lg_plus + lg_minus)
        R = i + 1

for p, e in N:
    def f(x):
        ans = 0
        while True:
            x //= p
            if x == 0:
                return ans
            ans += x
    if e != f(P) - f(P - R) - f(R):
        exit(print(-1, -1))

print(P, R)
0