# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19608 | noeffserv | Α (kriii4_P1) | C++98 | 0 ms | 1716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <functional>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <iostream>
#define ENP printf("**Entry Point**\n")
#define A first
#define B second
#define MP make_pair
using namespace std;
typedef long long ll;
typedef vector <double> vec_d;
typedef vector <vec_d> vvec_d;
typedef vector <int> vec_i;
typedef vector <vec_i> vvec_i;
typedef pair <int, int> pair_i;
typedef pair < pair_i, pair_i > pp_i;
const int INF = 0x60000000;
const int MINF = -1000000000;
const ll mod = 1000000007;
const int cons = 50000001;
ll table[64];
int main()
{
ll a, x;
cin >> a >> x;
a %= mod;
table[1] = a;
ll ans = 1;
for (int i = 2; i < 64; i++)
{
table[i] = (table[i - 1] * table[i - 1]) % mod;
}
for (int i = 63; i >= 1; i--)
{
ll t = (1LL << (i - 1));
if (x >= t)
{
x -= t;
ans = (ans * table[i]) % mod;
}
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |