結果
| 問題 | No.1140 EXPotentiaLLL! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-06 12:49:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 231 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 314,240 KB |
| 最終ジャッジ日時 | 2026-04-06 06:46:26 |
| 合計ジャッジ時間 | 7,460 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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:
ans = A**al[P]%P
print(ans)