# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203162 | coloredrabbit | Phibonacci (kriii2_P) | C++17 | 5 ms | 376 KiB |
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;
using ll=long long;
struct mat{
ll a,b;
ll c,d;
mat(ll x=0,ll y=0,ll z=0,ll w=0):a(x),b(y),c(z),d(w){}
};
const ll mod=1e9+7;
mat operator*(mat x,mat y){
return mat((x.a*y.a%mod+x.b*y.c%mod+mod)%mod, (x.a*y.b%mod+x.b*y.d%mod+mod)%mod,
(x.c*y.a%mod+x.d*y.c%mod+mod)%mod, (x.c*y.b%mod+x.d*y.d%mod+mod)%mod
);
}
mat matPow(mat x,ll n){
if(n==0)return mat(1,0,0,1);
if(n==1)return x;
if(n&1)return matPow(x*x,n/2)*x;
return matPow(x*x,n/2);
}
ll ipow(ll x,ll n){
if(n==0)return 1;
if(n==1)return x;
if(n&1)return ipow(x*x%mod,n/2)*x%mod;
return ipow(x*x%mod,n/2)%mod;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |