Submission #412944

# Submission time Handle Problem Language Result Execution time Memory
412944 2021-05-27T20:31:46 Z Pbezz Star Trek (CEOI20_startrek) C++14
7 / 100
1 ms 320 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> pii;
 
typedef tree<pii ,null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
const ll MAXN = 301;
const ll MOD = 1e9+7;
const ll INF = 1e6+10;

ll fast(ll d){

ll res=1;
if(d==0)return 1;
if(d%2==1)res=2;

ll k = fast(d/2);

res*=k; res%=MOD;
res*=k; res%=MOD;

return res;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n,d,i,u,v,ans;
	cin>>n>>d;

	for(i=0;i<n-1;i++){
	cin>>u>>v;
	}

	ans = fast(2*d);
	if(ans<0)ans+=MOD;
	cout<<ans<<endl;








return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 320 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 320 KB Output isn't correct