結果

問題 No.2207 pCr検査
ユーザー gew1fw
提出日時 2025-06-12 20:03:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 624 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 61,660 KB
最終ジャッジ日時 2025-06-12 20:08:17
合計ジャッジ時間 6,239 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def main():
    input = sys.stdin.read().split()
    idx = 0
    k = int(input[idx])
    idx += 1
    factors = []
    for _ in range(k):
        p = int(input[idx])
        e = int(input[idx+1])
        factors.append((p, e))
        idx += 2

    # Compute N as the product of p^e
    N = 1
    for p, e in factors:
        N *= p ** e

    for p, e in factors:
        if e != 1:
            continue
        M = N // p
        if M == 1:
            print(p, 1)
            return
        if 2 * M == p - 1:
            print(p, 2)
            return

    print(-1, -1)

if __name__ == '__main__':
    main()
0