結果

問題 No.1140 EXPotentiaLLL!
ユーザー lloyzlloyz
提出日時 2022-05-29 14:01:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 115,248 KB
最終ジャッジ日時 2023-10-20 23:46:57
合計ジャッジ時間 18,386 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,535 ms
115,204 KB
testcase_01 AC 1,535 ms
115,204 KB
testcase_02 WA -
testcase_03 AC 1,308 ms
115,232 KB
testcase_04 AC 1,100 ms
115,208 KB
testcase_05 AC 1,513 ms
115,232 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 381 ms
114,472 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 393 ms
114,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

IsPrime = [True for _ in range(5 * 10**6 + 1)]
IsPrime[0] = IsPrime[1] = False
for i in range(2, 5 * 10**6 + 1):
    if IsPrime[i]:
        for j in range(i + i, 5 * 10**6 + 1, i):
            IsPrime[j] = False

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