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 <bits/stdc++.h>
using namespace std;
const int MAXN=1e5, MOD=1e9+7;
vector<int> adj[MAXN+1];
long long power2(long long n)
{
long long result=1, current=2;
for (long long i=0; i<64; i++)
{
if (n&((long long)1<<i))
result=result*current%MOD;
current=current*current%MOD;
}
return result;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, x, y, i;
long long d;
cin >> n >> d;
for (i=0; i<n-1; i++)
{
cin >> x >> y;
adj[x].push_back(y);
adj[y].push_back(x);
}
cout << power2(d);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |