結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
|
提出日時 | 2022-11-19 19:23:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 846 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 146 ms |
コンパイル使用メモリ | 82,428 KB |
実行使用メモリ | 164,136 KB |
最終ジャッジ日時 | 2024-09-21 01:07:54 |
合計ジャッジ時間 | 10,175 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 |
ソースコード
import math t = int(input()) m = 5000000 prime = [True for _ in range(m + 1)] prime[1] = False for x in range(2, m + 1): if not prime[x]: continue prime[x] = True for y in range(2 * x, m + 1, x): prime[y] = False ans = [] for _ in range(t): a, p = map(int, input().split()) if not prime[p]: ans.append(-1) elif math.gcd(a, p) == 1: ans.append(1) else: ans.append(0) print(*ans, sep='\n')