Submission #2699925
Source Code Expand
#!/usr/bin/env python3 import sys, math, copy from functools import lru_cache # import fractions, itertools # import numpy as np # import scipy sys.setrecursionlimit(10 ** 6) MOD = 998244353 HUGE = 2147483647 HUGEL = 9223372036854775807 ABC = "abcdefghijklmnopqrstuvwxyz" @lru_cache(maxsize=10 ** 6) def fact(i): if i <= 1: return 1 return i * fact(i - 1) % MOD def combi(n, i): return fact(n) // (fact(i) * fact(n - i)) def main(): n, a, b, k = map(int, input().split()) print(n, a, b, k) res = 0 for i in range(0, n + 1): residual = k - a * i if residual < 0: continue if residual % b > 0: continue j = residual // b res += combi(n, i) * combi(n, j) res %= MOD print(res) main()
Submission Info
Submission Time | |
---|---|
Task | B - RGB Coloring |
User | sen_7 |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 799 Byte |
Status | RE |
Exec Time | 2140 ms |
Memory | 652100 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample01.txt, sample02.txt, sample03.txt |
All | sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, sample01.txt, sample02.txt, sample03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | RE | 1585 ms | 652100 KB |
in02.txt | RE | 1607 ms | 652100 KB |
in03.txt | RE | 1630 ms | 652100 KB |
in04.txt | RE | 1594 ms | 652100 KB |
in05.txt | RE | 1609 ms | 652100 KB |
in06.txt | RE | 1609 ms | 652100 KB |
in07.txt | RE | 1588 ms | 652100 KB |
in08.txt | WA | 610 ms | 251460 KB |
in09.txt | RE | 1611 ms | 652100 KB |
in10.txt | WA | 1764 ms | 633028 KB |
in11.txt | RE | 1604 ms | 652100 KB |
in12.txt | WA | 766 ms | 295876 KB |
in13.txt | TLE | 2140 ms | 584132 KB |
in14.txt | WA | 554 ms | 134724 KB |
in15.txt | WA | 782 ms | 271172 KB |
in16.txt | WA | 284 ms | 89924 KB |
in17.txt | TLE | 2137 ms | 554820 KB |
in18.txt | RE | 1592 ms | 652100 KB |
in19.txt | RE | 1593 ms | 652100 KB |
in20.txt | RE | 1596 ms | 652100 KB |
in21.txt | WA | 23 ms | 3652 KB |
sample01.txt | WA | 23 ms | 3652 KB |
sample02.txt | WA | 23 ms | 3652 KB |
sample03.txt | WA | 606 ms | 250820 KB |