結果

問題 No.1140 EXPotentiaLLL!
ユーザー aaaaaaaaaa2230
提出日時 2020-08-05 23:52:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,292 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 117,032 KB
最終ジャッジ日時 2024-09-18 18:12:23
合計ジャッジ時間 16,525 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

MA = 5*10**6+1
s = [0]*(MA)

s[1] = 2
for i in range(2,MA):
    for j in range(i,MA,i):
        s[j] += 1
    

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