結果
| 問題 | No.2631 Rectangle Grid Game | 
| コンテスト | |
| ユーザー | 👑  potato167 | 
| 提出日時 | 2024-02-12 02:00:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,032 bytes | 
| コンパイル時間 | 1,934 ms | 
| コンパイル使用メモリ | 192,552 KB | 
| 最終ジャッジ日時 | 2025-02-19 05:31:13 | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
struct mint{
    static constexpr int  m = 998244353;
    int x;
    mint() : x(0){}
    mint(ll x_):x(x_%m){if(x<0)x+=m;}
    mint &operator+=(mint b){if((x+=b.x)>=m)x-=m; return *this;}
    mint &operator-=(mint b){if((x-=b.x)<0)x+=m; return *this;}
    mint &operator*=(mint b){x=ll(x)*b.x%m; return *this;}
    mint pow(ll e) const {
        mint r = 1,b =*this;
        while(e){
            if(e&1) r*=b;
            b*=b;
            e>>=1;
        }
        return r;
    }
    mint inv(){return pow(m-2);}
    mint &operator/=(mint b){return *this*=b.pow(m-2);}
    friend mint operator+(mint a,mint b){return a+=b;}
    friend mint operator-(mint a,mint b){return a-=b;}
    friend mint operator/(mint a,mint b){return a/=b;}
    friend mint operator*(mint a,mint b){return a*=b;}
};
int main(){
	ll H,W;
	cin>>H>>W;
	mint h=H,w=W;
	auto f=[&](ll a) -> mint {
		return mint(a+a/2)*mint(a-a/2-1)/2;
	};
	cout<<((w*w*f(H)+h*h*f(W))*2-f(H)*f(W)*4).x<<"\n";
}
            
            
            
        