結果

問題 No.1140 EXPotentiaLLL!
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2020-08-05 23:47:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 302 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 117,048 KB
最終ジャッジ日時 2023-10-18 22:03:55
合計ジャッジ時間 23,005 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
input = sys.stdin.readline

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