結果

問題 No.1140 EXPotentiaLLL!
ユーザー tamatotamato
提出日時 2020-07-31 21:28:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 117,788 KB
最終ジャッジ日時 2023-09-20 21:39:21
合計ジャッジ時間 7,639 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 463 ms
117,336 KB
testcase_01 AC 461 ms
117,196 KB
testcase_02 WA -
testcase_03 AC 433 ms
117,496 KB
testcase_04 AC 404 ms
117,776 KB
testcase_05 AC 450 ms
117,696 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 266 ms
116,096 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 277 ms
116,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

    N0 = 5*10**6
    is_prime = [1] * (N0+1)
    is_prime[0] = is_prime[1] = 0
    for i in range(2, N0+1):
        if is_prime[i] == 0:
            continue
        for j in range(2, N0+1):
            if i*j > N0:
                break
            is_prime[i*j] = 0

    for _ in range(int(input())):
        a, p = map(int, input().split())
        if is_prime[p]:
            print(1)
        else:
            print(-1)


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