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 <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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |