結果
| 問題 | No.2631 Rectangle Grid Game | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-02-16 23:44:43 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 48 ms / 2,000 ms | 
| コード長 | 922 bytes | 
| コンパイル時間 | 15,335 ms | 
| コンパイル使用メモリ | 168,232 KB | 
| 実行使用メモリ | 185,128 KB | 
| 最終ジャッジ日時 | 2024-09-28 22:47:25 | 
| 合計ジャッジ時間 | 9,072 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (94 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (h, w) = (c[0], c[1]);
        WriteLine(Game(h, w));
    }
    static long Game(long h, long w)
    {
        var mod = 998_244_353;
        var h2 = h / 2 + 1;
        var w2 = w / 2 + 1;
        var res = (h2 - 1) * (w2 - 1) % mod * ((h2 * w2 % mod + h2 * 2 + w2 * 2) % mod) % mod;
        if (h % 2 == 1) res = (res + w / 2 * (w / 2 + 1) % mod) % mod;
        if (w % 2 == 1) res = (res + h / 2 * (h / 2 + 1) % mod) % mod;
        var all = h * w % mod * ((h * w - 1) % mod) % mod;
        return (all - res + mod) % mod;
    }
}
            
            
            
        