結果

問題 No.1140 EXPotentiaLLL!
ユーザー zkouzkou
提出日時 2020-07-31 21:44:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 382 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 73,184 KB
最終ジャッジ日時 2023-09-20 22:40:36
合計ジャッジ時間 17,100 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,986 ms
39,012 KB
testcase_01 AC 1,926 ms
34,228 KB
testcase_02 AC 1,971 ms
34,748 KB
testcase_03 AC 1,767 ms
34,264 KB
testcase_04 AC 1,636 ms
34,300 KB
testcase_05 AC 1,945 ms
34,220 KB
testcase_06 AC 1,967 ms
34,624 KB
testcase_07 TLE -
testcase_08 AC 1,109 ms
34,376 KB
testcase_09 AC 1,099 ms
34,168 KB
testcase_10 AC 1,146 ms
33,980 KB
testcase_11 AC 1,094 ms
34,412 KB
testcase_12 AC 1,094 ms
73,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np

input = sys.stdin.buffer.readline

table_len = 5000005
table = np.full(table_len, True)
table[0] = False
table[1] = False
for i in range(2, table_len):
    if table[i]:
        table[2*i::i] = False


T = int(input())
for _ in range(T):
    A, P = map(int, input().split())
    if table[P]:
        print(1 if A % P else 0)
    else:
        print(-1)
0