# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56824 | youngyojun | Phibonacci (kriii2_P) | C++11 | 4 ms | 792 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;
typedef long long ll;
const ll MOD = 1000000007;
void add(ll &a, ll b) { a = ((a+b) % MOD + MOD) % MOD; }
struct MAT {
MAT() { d[0][0] = d[0][1] = d[1][0] = d[1][1] = 0; }
ll d[2][2];
MAT operator * (const MAT t) const {
MAT ret;
for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) for(int k = 0; k < 2; k++)
add(ret.d[i][j], d[i][k] * t.d[k][j]);
return ret;
}
};
ll pw(ll n, ll k) {
ll ret = 1;
for(; k; k >>= 1) {
if(k&1) ret = ret*n % MOD;
n = n*n % MOD;
}
ret = (ret + MOD) % MOD;
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |