結果

問題 No.1140 EXPotentiaLLL!
ユーザー chineristACchineristAC
提出日時 2020-07-31 21:52:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 151,732 KB
最終ジャッジ日時 2023-09-20 22:58:52
合計ジャッジ時間 8,895 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 605 ms
151,480 KB
testcase_01 AC 529 ms
151,368 KB
testcase_02 WA -
testcase_03 AC 495 ms
151,508 KB
testcase_04 AC 460 ms
151,404 KB
testcase_05 AC 533 ms
151,388 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 336 ms
150,996 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 340 ms
151,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

prime=set([])

def factorization(n):
    res=[0 for i in range(n+1)]
    for i in range(2,n+1):
        if not res[i]:
            prime.add(i)
            for j in range(1,(n)//i+1):
                res[i*j]+=1

factorization(5*10**6)

import sys

input=sys.stdin.buffer.readline
for _ in range(int(input())):
    a,p=map(int,input().split())
    if p in prime:
        if a==0:
            print(0)
        else:
            print(1)
    else:
        print(-1)
0