結果

問題 No.1140 EXPotentiaLLL!
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-08-05 23:44:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 263 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,424 KB
実行使用メモリ 115,056 KB
最終ジャッジ日時 2023-10-18 22:00:06
合計ジャッジ時間 31,865 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 WA -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,132 ms
114,144 KB
testcase_09 AC 1,135 ms
114,144 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,124 ms
114,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MA = 5*10**6+1
s = [0]*(MA)

s[1] = 2
for i in range(2,MA):
    for j in range(i,MA,i):
        s[j] += 1
    

t = int(input())
for _ in range(t):
    a,p = map(int,input().split())
    if s[p] == 1:
        print(pow(a,p*(p+1)//2,p))
    else:
        print(-1)
0