結果

問題 No.1140 EXPotentiaLLL!
ユーザー rin204rin204
提出日時 2020-08-13 07:03:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 508 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 57,056 KB
最終ジャッジ日時 2024-04-18 01:13:58
合計ジャッジ時間 10,276 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,817 ms
49,972 KB
testcase_09 AC 1,870 ms
49,828 KB
testcase_10 AC 1,898 ms
50,028 KB
testcase_11 AC 1,967 ms
51,828 KB
testcase_12 AC 1,971 ms
49,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

p_max = 5 * (10 ** 6)
prime = [True for _ in range(p_max + 1)]
prime[0] = False
prime[1] = False
p_max = 5 * (10 ** 6)
for i in range(2, int(p_max ** 0.5) + 1):
    if not prime[i]:
        continue
    for j in range(2 * i, p_max + 1, i):
        prime[j] = False

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