結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | c-yan |
提出日時 | 2020-08-02 04:59:27 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,401 ms / 2,000 ms |
コード長 | 698 bytes |
コンパイル時間 | 133 ms |
コンパイル使用メモリ | 10,900 KB |
実行使用メモリ | 63,452 KB |
最終ジャッジ日時 | 2023-09-24 22:29:03 |
合計ジャッジ時間 | 17,444 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,334 ms
63,400 KB |
testcase_01 | AC | 1,315 ms
63,332 KB |
testcase_02 | AC | 1,363 ms
63,452 KB |
testcase_03 | AC | 1,219 ms
60,112 KB |
testcase_04 | AC | 1,114 ms
57,156 KB |
testcase_05 | AC | 1,339 ms
62,924 KB |
testcase_06 | AC | 1,314 ms
62,128 KB |
testcase_07 | AC | 1,401 ms
63,384 KB |
testcase_08 | AC | 718 ms
46,984 KB |
testcase_09 | AC | 707 ms
46,856 KB |
testcase_10 | AC | 716 ms
47,000 KB |
testcase_11 | AC | 716 ms
47,028 KB |
testcase_12 | AC | 719 ms
46,900 KB |
ソースコード
def make_prime_table(n): sieve = [True] * (n + 1) sieve[0] = False sieve[1] = False for i in range(2, int(n ** 0.5) + 1): if not sieve[i]: continue for j in range(i * i, n + 1, i): sieve[j] = False return sieve def main(): readline = open(0).readline prime_table = make_prime_table(5 * 10 ** 6) T = int(readline()) result = [] for _ in range(T): A, P = map(int, readline().split()) if not prime_table[P]: result.append(-1) else: if A % P == 0: result.append(0) else: result.append(1) print(*result, sep='\n') main()