# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9797 | maniac | Quaternion inverse (kriii2_Q) | C++98 | 1000 ms | 1244 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>
int d[10][10][10][10][4];
bool can( int a1, int b1, int c1, int d1, int a2, int b2, int c2, int d2, int M ){
int m = M*M;
if( (a1*a2 + m - (b1*b2)%m + m - (c1*c2)%m + m - (d1*d2)%m )%M != 1 ) return 0;
//printf("%d\n", (a1*b2 + b1*a2 +c1*d2 + m -(d1*c2)%M )%M);
if( (a1*b2 + b1*a2 +c1*d2 + m -(d1*c2)%M )%M != 0 ) return 0;
if( (a1*c2 + m - (b1*d2)%m + c1*a2 + d1*b2)%M != 0 ) return 0;
if( (a1*d2 + b1*c2 + m - (c1*b2)%m + d1*a2 )%M != 0 ) return 0;
return 1;
}
void go( int a, int b, int c, int d1, int m ){
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
for(int k=0; k<m; k++){
for(int r=0; r<m; r++){
if( can( a, b, c, d1, i, j, k, r, m ) ) {
d[a][b][c][d1][0] = i;
d[a][b][c][d1][1] = j;
d[a][b][c][d1][2] = k;
d[a][b][c][d1][3] = r;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |