Submission details
Task:Exponentiation
Sender:duongha
Submission time:2025-11-19 00:44:00 +0200
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.02 sdetails
#20.38 sdetails
#30.37 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll; 
const ll INF = 1e18;
const int MAXN = 1e5 + 1;
const int MOD = 1e9 + 7;

ll n;
ll a, b;

ll mul(ll c, ll x) {
    if (x == 1 or x == 0) return 1;
    
    ll temp = x / 2;
    ll ans = mul(c, temp) % MOD;
    if (x % 2 == 1) return ans * ans * ans;
    else return ans * ans;
}

void solve() {
   cin >> n; 
   
   for (int i = 1; i <= n; i++) {
       cin >> a >> b;
       
       cout << mul(a, b) << endl;
   }
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    solve();
 
    return 0;
}

Test details

Test 1

Verdict:

input
10201
0 0
0 1
0 2
0 3
...

correct output
1
0
0
0
0
...

user output
1
1
1
1
1
...
Truncated

Feedback: Incorrect character on line 2 col 1: expected "0", got "1"

Test 2

Verdict:

input
200000
129612095 411099530
241615980 487174929
60862511 511830781
758816482 982657640
...

correct output
276067146
838400234
148093882
546897305
467086232
...

user output
1
1
1
1
1
...
Truncated

Feedback: Incorrect character on line 1 col 1: expected "276067146", got "1"

Test 3

Verdict:

input
200000
692427692 536870911
252480658 536870911
505090334 536870911
27194853 536870911
...

correct output
940305728
707431813
917260341
908974199
375947818
...

user output
1
1
1
1
1
...
Truncated

Feedback: Incorrect character on line 1 col 1: expected "940305728", got "1"