結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
|
提出日時 | 2020-12-06 12:50:29 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 408 bytes |
コンパイル時間 | 147 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 273,524 KB |
最終ジャッジ日時 | 2024-09-17 11:55:58 |
合計ジャッジ時間 | 7,487 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | TLE * 1 -- * 11 |
ソースコード
from math import sqrt from itertools import accumulate N = 5*(10**6)+1 l = [i for i in range(N)] al = list(accumulate(l)) T = int(input()) for _ in range(T): A,P = map(int,input().split()) flg = False for i in range(2,int(sqrt(P)+1)): if P%i == 0: flg = True break if flg: print(-1) else: a = A%P ans = a**al[P]%P print(ans)