Submission #19545890


Source Code Expand

Copy
class Factorial:
    def __init__(self, max_fact, mod):
        #mod should be prime number
        #using homogeneous_product(n,r), max_fact ≧ max(n+r-1)
        f = [1] * (max_fact + 1)
        for idx in range(2, max_fact + 1):
            f[idx] = f[idx - 1] * idx
            f[idx] %= mod
        if mod > max_fact:
            fi = [pow(f[-1], mod - 2, mod)]
            for idx in range(max_fact, 0, -1):
                fi += [fi[-1] * idx % mod]
            fi = fi[::-1]
        else:
            fi = [pow(n, mod - 2, mod) for n in f]
        self.mod = mod
        self.f = f
        self.fi = fi

    def factorial(self, n):
        return self.f[n]

    def factorial_inverse(self, n):
        return self.fi[n]

    def combination(self, n, r):
        f = self.f
        fi = self.fi
        return f[n] * fi[r] * fi[n - r] % self.mod

    def permutation(self, n, r):
        return self.f[n] * self.fi[n - r] % self.mod

    def homogeneous_product(self, n, r):
        f = self.f
        fi = self.fi
        return f[n + r - 1] * fi[r] * fi[n - 1] % self.mod


max_fact = 10**6
mod = 998244353
fact_instance = Factorial(max_fact, mod)
comb = fact_instance.combination
d = int(input())
ans = comb(2 * d - 1, d - 1)
print(ans)

Submission Info

Submission Time
Task A - Dodecagon
User yydoco
Language Python (3.8.2)
Score 0
Code Size 1294 Byte
Status RE
Exec Time 481 ms
Memory 95616 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 1
AC × 7
RE × 5
Set Name Test Cases
Sample example0.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, example0.txt
Case Name Status Exec Time Memory
000.txt RE 481 ms 95512 KB
001.txt AC 476 ms 95420 KB
002.txt AC 476 ms 95448 KB
003.txt RE 479 ms 95516 KB
004.txt RE 479 ms 95424 KB
005.txt AC 478 ms 95548 KB
006.txt AC 476 ms 95576 KB
007.txt AC 476 ms 95616 KB
008.txt RE 478 ms 95464 KB
009.txt RE 476 ms 95376 KB
010.txt AC 479 ms 95416 KB
example0.txt AC 477 ms 95376 KB