# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9219 | lemonsqueeze | Quaternion inverse (kriii2_Q) | C++98 | 424 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 <stdio.h>
#include <algorithm>
using namespace std;
long long M;
long long A[4][4];
long long B[4];
long long x[4];
const int n=4;
long long getpow (long long x, long long b)
{
if (b==0) return 1;
if (b==1) return x;
long long res = getpow (x, b/2);
res = (res * res) % M;
if (b&1) return (res * x) % M;
return res;
}
long long getinv (long long x)
{
// x^(M-1) = 1
// return x^(M-2)
return getpow (x, M-2);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |