Submission #649481

#TimeUsernameProblemLanguageResultExecution timeMemory
649481DangerNoodle7591Binary Subsequences (info1cup17_binary)C++17
0 / 100
1 ms340 KiB
#include <iostream> using namespace std; #define mod 1000000007 long long int fast_pow(int x,int us){ if(us==1){return x%mod;} int mid=us/2; long long a=fast_pow(x,mid)%mod; if(us%2==0) return (a*a)%mod; return (a*a*x)%mod; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t;cin>>t; while(t--){ int x;cin>>x; if(x==1){ cout<<2<<"\n"<<-1<<"\n"; continue; } cout<<fast_pow(2,x-1)%mod<<"\n"<<-1<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...