結果

問題 No.1140 EXPotentiaLLL!
ユーザー O2MTO2MT
提出日時 2020-12-06 14:00:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 493 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 77,248 KB
最終ジャッジ日時 2024-09-17 13:02:44
合計ジャッジ時間 7,370 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 1
other TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def eratosthenes_sieve(n):

    table = [0] * (n+1)
    prime_list = []
    for i in range(2, n+1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(i+i, n+1, i):
                table[j] = 1
    return prime_list

N = 5*(10**6)+1
E = set(eratosthenes_sieve(N))
T = int(input())
for _ in range(T):
    A,P = map(int,input().split())
    if P not in E:
        print(-1)
    else:
        if A%P != 0:
            print(1)
        else:
            print(0)
0