# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19688 | Namnamseo | 괄호 (kriii4_R) | C++14 | 419 ms | 32332 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>
typedef long long ll;
const ll M=int(1e9)+7;
ll catalan[1000010];
ll fact[2000010];
ll kpow[1000010];
ll pow(ll a,ll b){
if(b==0) return 1;
ll ret=pow(a,b/2);
ret=(ret*ret)%M;
if(b&1) ret=(ret*a)%M;
return ret;
}
int main()
{
int n,k;
int i;
scanf("%d%d",&n,&k);
fact[0]=1;
kpow[0]=1;
for(i=1; i<=2*n; ++i) fact[i]=(fact[i-1]*i)%M;
catalan[0]=1;
for(i=1; i<=n; ++i){
catalan[i] = fact[2*i] * pow( fact[i+1]*fact[i]%M, M-2 ) %M;
kpow[i] = (kpow[i-1]*k)%M;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |