結果
問題 | No.2683 Two Sheets |
ユーザー | arad |
提出日時 | 2023-12-13 17:12:40 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,170 bytes |
コンパイル時間 | 518 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 16,000 KB |
最終ジャッジ日時 | 2024-09-27 05:28:37 |
合計ジャッジ時間 | 27,155 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,880 KB |
testcase_01 | AC | 30 ms
10,624 KB |
testcase_02 | AC | 159 ms
10,752 KB |
testcase_03 | TLE | - |
testcase_04 | AC | 509 ms
10,752 KB |
testcase_05 | TLE | - |
testcase_06 | AC | 1,815 ms
10,624 KB |
testcase_07 | AC | 1,494 ms
10,624 KB |
testcase_08 | TLE | - |
testcase_09 | AC | 1,579 ms
10,752 KB |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | AC | 1,967 ms
10,880 KB |
testcase_13 | AC | 1,803 ms
10,624 KB |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
ソースコード
#https://qiita.com/wotsushi/items/c936838df992b706084c MOD = 998244353 class ModInt: def __init__(self, x): self.x = x % MOD def __str__(self): return str(self.x) __repr__ = __str__ def __add__(self, other): return ( ModInt(self.x + other.x) if isinstance(other, ModInt) else ModInt(self.x + other) ) def __sub__(self, other): return ( ModInt(self.x - other.x) if isinstance(other, ModInt) else ModInt(self.x - other) ) def __mul__(self, other): return ( ModInt(self.x * other.x) if isinstance(other, ModInt) else ModInt(self.x * other) ) def __truediv__(self, other): return ( ModInt( self.x * pow(other.x, MOD - 2, MOD) ) if isinstance(other, ModInt) else ModInt(self.x * pow(other, MOD - 2, MOD)) ) def __pow__(self, other): return ( ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else ModInt(pow(self.x, other, MOD)) ) __radd__ = __add__ def __rsub__(self, other): return ( ModInt(other.x - self.x) if isinstance(other, ModInt) else ModInt(other - self.x) ) __rmul__ = __mul__ def __rtruediv__(self, other): return ( ModInt( other.x * pow(self.x, MOD - 2, MOD) ) if isinstance(other, ModInt) else ModInt(other * pow(self.x, MOD - 2, MOD)) ) def __rpow__(self, other): return ( ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else ModInt(pow(other, self.x, MOD)) ) h, w, a, b = map(int, input().split()) ans0 = ModInt(0) for i in range(h): l = max(0, i - a + 1) r = min(h - a, i) ad = ModInt(r - l + 1) / (h - a + 1) ad *= ad ans0 += ad ans1 = ModInt(0) for i in range(w): l = max(0, i - b + 1) r = min(w - b, i) ad = ModInt(r - l + 1) / (w - b + 1) ad *= ad ans1 += ad ans = ans0 * ans1 ans = 2 * ModInt(a) * ModInt(b) - ans print(ans)