結果

問題 No.1140 EXPotentiaLLL!
ユーザー takakintakakin
提出日時 2020-08-10 23:18:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 668 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,828 KB
実行使用メモリ 156,212 KB
最終ジャッジ日時 2024-04-17 06:51:54
合計ジャッジ時間 9,060 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 616 ms
155,648 KB
testcase_01 AC 612 ms
155,136 KB
testcase_02 AC 585 ms
156,212 KB
testcase_03 AC 552 ms
155,136 KB
testcase_04 AC 499 ms
154,496 KB
testcase_05 AC 588 ms
155,776 KB
testcase_06 AC 592 ms
155,584 KB
testcase_07 AC 668 ms
156,068 KB
testcase_08 AC 353 ms
153,728 KB
testcase_09 AC 354 ms
153,776 KB
testcase_10 AC 351 ms
153,984 KB
testcase_11 AC 356 ms
153,728 KB
testcase_12 AC 345 ms
154,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
t=int(input())
n=10**7
sieve=[-1]*(n+1)
for i in range(2,n+1):
  if sieve[i]==-1:
    sieve[i]=i
    for j in range(i*i,n+1,i):
      if sieve[j]==-1:
        sieve[j]=i
for _ in range(t):
	a,p=map(int,input().split())
	if sieve[p]==p:
		if a%p==0:
			print(0)
		else:
			print(1)
	else:
		print(-1)
0