結果

問題 No.1140 EXPotentiaLLL!
ユーザー c-yanc-yan
提出日時 2020-07-31 21:38:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 155,352 KB
最終ジャッジ日時 2023-09-20 22:13:19
合計ジャッジ時間 8,001 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 526 ms
155,228 KB
testcase_01 AC 532 ms
155,352 KB
testcase_02 WA -
testcase_03 AC 483 ms
142,864 KB
testcase_04 AC 431 ms
134,156 KB
testcase_05 AC 522 ms
153,368 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 265 ms
115,508 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 263 ms
115,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_prime_table(n):
    sieve = list(range(n + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(n ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, n + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve

from sys import stdin
readline = stdin.readline

prime_table = make_prime_table(5 * 10 ** 6)

T = int(readline())
result = []
for _ in range(T):
    A, P = map(int, readline().split())
    if prime_table[P] != P:
        result.append(-1)
    else:
        result.append(1)
print(*result, sep='\n')
0