Submission #19545873
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, d) // 2 print(ans)
Submission Info
Submission Time | |
---|---|
Task | A - Dodecagon |
User | yydoco |
Language | Python (3.8.2) |
Score | 0 |
Code Size | 1291 Byte |
Status | RE |
Exec Time | 479 ms |
Memory | 95660 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||||
Status |
|
|
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 | 479 ms | 95556 KB |
001.txt | AC | 475 ms | 95552 KB |
002.txt | WA | 476 ms | 95568 KB |
003.txt | RE | 476 ms | 95660 KB |
004.txt | RE | 477 ms | 95604 KB |
005.txt | WA | 479 ms | 95568 KB |
006.txt | WA | 477 ms | 95568 KB |
007.txt | WA | 477 ms | 95612 KB |
008.txt | RE | 476 ms | 95444 KB |
009.txt | RE | 471 ms | 95544 KB |
010.txt | AC | 478 ms | 95560 KB |
example0.txt | AC | 469 ms | 95572 KB |