結果
問題 | No.2631 Rectangle Grid Game |
ユーザー |
![]() |
提出日時 | 2024-02-12 02:20:43 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 429 bytes |
コンパイル時間 | 4,724 ms |
コンパイル使用メモリ | 309,372 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 17:56:47 |
合計ジャッジ時間 | 5,170 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using ll = long long; using mint = atcoder::modint998244353; int main(){ ll h, w; cin >> h >> w; mint a = h/2, b = w/2; mint ans = 2*a*b*(a+1+b+1) + a*(a+1)*b*(b+1); if (h % 2 == 1){ ans += b*(b+1); } if (w % 2 == 1){ ans += a*(a+1); } mint tot = h*w; ans = tot*(tot-1) - ans; cout << ans.val() << endl; }