結果
問題 | No.1140 EXPotentiaLLL! |
ユーザー | ayaoni |
提出日時 | 2021-04-20 13:21:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 664 ms / 2,000 ms |
コード長 | 1,167 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 87,016 KB |
実行使用メモリ | 196,652 KB |
最終ジャッジ日時 | 2023-09-17 08:40:07 |
合計ジャッジ時間 | 10,054 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 575 ms
196,020 KB |
testcase_01 | AC | 582 ms
196,168 KB |
testcase_02 | AC | 574 ms
196,364 KB |
testcase_03 | AC | 582 ms
196,652 KB |
testcase_04 | AC | 512 ms
196,180 KB |
testcase_05 | AC | 604 ms
196,580 KB |
testcase_06 | AC | 610 ms
196,532 KB |
testcase_07 | AC | 664 ms
196,404 KB |
testcase_08 | AC | 325 ms
194,652 KB |
testcase_09 | AC | 324 ms
194,820 KB |
testcase_10 | AC | 325 ms
194,788 KB |
testcase_11 | AC | 324 ms
195,036 KB |
testcase_12 | AC | 320 ms
194,996 KB |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) def sieve_of_eratosthenes(n): # n以下の素数の全列挙 prime_list = [] is_prime = [1]*(n+1) # A[i] = iが素数なら1,その他は0 is_prime[0] = is_prime[1] = 0 for i in range(2,int(n**.5)+1): if is_prime[i]: prime_list.append(i) for j in range(i**2,n+1,i): is_prime[j] = 0 for i in range(int(n**.5)+1,n+1): if is_prime[i] == 1: prime_list.append(i) return prime_list prime_list = sieve_of_eratosthenes(5*10**6) prime_list = set(prime_list) T = I() for _ in range(T): A,P = MI() if P not in prime_list: print(-1) continue if A % P == 0: print(0) else: print(1)