| Task: | Exponentiation |
| Sender: | luukwin |
| Submission time: | 2025-11-15 12:29:14 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | TIME LIMIT EXCEEDED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.29 s | details |
| #2 | TIME LIMIT EXCEEDED | -- | details |
| #3 | ACCEPTED | 1.00 s | details |
Code
import sys
sys.setrecursionlimit(5000)
h = int(input())
answers = []
modulo = 10**9 + 7
def modpower(x, n, m):
if n == 0: return 1 % m
u = modpower(x, n//2, m)
u =(u*u)%m
if (n%2==1): u = (u*x)%m
return u
for i in range(h):
a, b = [int(x) for x in input().split()]
print(modpower(a, b, modulo))
# answers.append(str(modpower(a, b, modulo)))
# print("\n".join(answers))Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 10201 0 0 0 1 0 2 0 3 ... |
| correct output |
|---|
| 1 0 0 0 0 ... |
| user output |
|---|
| 1 0 0 0 0 ... Truncated |
Test 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 129612095 411099530 241615980 487174929 60862511 511830781 758816482 982657640 ... |
| correct output |
|---|
| 276067146 838400234 148093882 546897305 467086232 ... |
| user output |
|---|
| (empty) |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 200000 692427692 536870911 252480658 536870911 505090334 536870911 27194853 536870911 ... |
| correct output |
|---|
| 940305728 707431813 917260341 908974199 375947818 ... |
| user output |
|---|
| 940305728 707431813 917260341 908974199 375947818 ... Truncated |
