# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19889 | Qwaz | 순열 (kriii4_T) | C++98 | 0 ms | 5816 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 <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll mod = 1000000007LL;
int times_mod(int a, int b) {
return ll(a) * ll(b) % mod;
}
// solves a*x + b*y = d = gcd(a, b)
// if d == 1, x is a modular inverse of a mod b
void extended_gcd(ll a, ll b, ll &d, ll &x, ll &y)
{
if(a < 0) {extended_gcd(-a, b, d, x, y); x *= -1; return;}
if(b < 0) {extended_gcd(a, -b, d, x, y); y *= -1; return;}
x = 0, y = 1;
ll lx = 1, ly = 0, frac, tmp;
while(b)
{
frac = a / b;
tmp = a; a = b; b = tmp % b;
tmp = x; x = lx - frac * x; lx = tmp;
tmp = y; y = ly - frac * y; ly = tmp;
}
x = lx; y = ly; d = a;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |