結果

問題 No.2631 Rectangle Grid Game
ユーザー maksimmaksim
提出日時 2024-02-16 23:11:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 1,807 ms
コンパイル使用メモリ 166,836 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-28 21:49:54
合計ジャッジ時間 3,080 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define app push_back
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(...) [](auto...a){ ((cout << a << ' '), ...) << endl;}(#__VA_ARGS__, ":", __VA_ARGS__)
#else
#define debug(...)
#endif
#ifdef LOCAL
#define __int128 long long
#endif // LOCAL
const int p=998244353;
int c2(int n) {return (n*(n-1)/2)%p;}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int h,w;cin>>h>>w;
    int ans=4*c2(h/2+1)*c2(w/2+1);ans%=p;
    ans+=2*h*c2(w/2+1);ans%=p;ans+=2*w*c2(h/2+1);ans%=p;
    cout<<((2*c2((h*w)%p)-ans)%p+p)%p;
    return 0;
}
0