Submission #412944

#TimeUsernameProblemLanguageResultExecution timeMemory
412944PbezzStar Trek (CEOI20_startrek)C++14
7 / 100
1 ms320 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...