結果
| 問題 | No.2631 Rectangle Grid Game | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-02-16 23:04:40 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 44 ms / 2,000 ms | 
| コード長 | 563 bytes | 
| コンパイル時間 | 253 ms | 
| コンパイル使用メモリ | 82,644 KB | 
| 実行使用メモリ | 56,400 KB | 
| 最終ジャッジ日時 | 2024-09-28 21:39:36 | 
| 合計ジャッジ時間 | 2,453 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
h,w = map(int,input().split())
if h % 2 == 0:
    hh = h//2-1
else:
    hh = h//2
    
if w % 2 == 0:
    ww = w//2-1
else:
    ww = w//2
all = ((1+hh)*hh//2) * ((1+ww)*ww//2) * 4
lh = h-hh*2
lw = w-ww*2
all += ((1+ww)*ww//2) * h * lh * 2
all += ((1+hh)*hh//2) * w * lw * 2
all += h*w *lh*lw
ans = (h*w)**2 - all 
print(ans%998244353)
            
            
            
        