# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9821 | veckal | Phibonacci (kriii2_P) | C++14 | 0 ms | 1088 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<cstdio>
#include<utility>
using namespace std;
typedef long long ll;
const int MOD = 1000000000 + 7;
ll n, k;
struct Matrix {
ll mat[2][2];
Matrix() {
mat[0][0]=mat[0][1]=mat[1][0]=mat[1][1]=0;
}
};
Matrix operator *(Matrix& A, Matrix& B) {
Matrix ret;
for (int i=0; i<2; ++i)
for (int j=0; j<2; ++j)
for (int k=0; k<2; ++k)
ret.mat[i][j] = (ret.mat[i][j] + A.mat[i][k] * B.mat[k][j])%MOD;
return ret;
}
Matrix power(Matrix base, ll exp) {
Matrix ret;
ret.mat[0][0] = ret.mat[1][1] = 1;
while(exp) {
if (exp&1) ret = ret * base;
base = base * base;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |