結果

問題 No.1140 EXPotentiaLLL!
ユーザー ShirotsumeShirotsume
提出日時 2023-02-17 19:52:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,163 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 158,432 KB
最終ジャッジ日時 2023-09-26 17:18:37
合計ジャッジ時間 15,621 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,065 ms
158,176 KB
testcase_01 AC 1,056 ms
157,744 KB
testcase_02 AC 1,049 ms
158,036 KB
testcase_03 AC 1,009 ms
157,244 KB
testcase_04 AC 950 ms
157,136 KB
testcase_05 AC 1,053 ms
157,556 KB
testcase_06 AC 1,033 ms
157,540 KB
testcase_07 AC 1,163 ms
158,432 KB
testcase_08 AC 772 ms
155,628 KB
testcase_09 AC 779 ms
155,728 KB
testcase_10 AC 768 ms
155,628 KB
testcase_11 AC 772 ms
155,788 KB
testcase_12 AC 779 ms
155,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
maxi = 10 ** 7
prime = [True] * (maxi)
prime[0] = prime[1] = False

for i in range(2, maxi):
    if prime[i]:
        for j in range(2 * i, maxi, i):
            prime[j] = False
from math import gcd
for _ in range(ii()):
    a, p = mi()
    if prime[p]:
        print(int(gcd(p, a) == 1))
    else:
        print(-1)
0