結果

問題 No.2683 Two Sheets
ユーザー aradarad
提出日時 2023-12-12 16:30:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,308 bytes
コンパイル時間 5,541 ms
コンパイル使用メモリ 264,324 KB
実行使用メモリ 161,948 KB
最終ジャッジ日時 2023-12-13 15:32:14
合計ジャッジ時間 8,287 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;

using mint = modint998244353;

int main(){
    int h,w,a,b;
    cin >> h >> w >> a >> b;
    mint ans = 0;
    for(int x0 = 0;x0 <= h-a;x0++){
        for(int y0 = 0;y0 <= w-b;y0++){
            for(int x1 = 0;x1 <= h-a;x1++){
                for(int y1 = 0;y1 <= w-b;y1++){
                    vector<vector<int>> board(h,vector<int>(w));
                    for(int i = x0;i < x0+a;i++){
                        for(int j = y0;j < y0+b;j++){
                            board[i][j] = 1;
                        }
                    }
                    for(int i = x1;i < x1+a;i++){
                        for(int j = y1;j < y1+b;j++){
                            board[i][j] = 1;
                        }
                    }
                    int count = 0;
                    for(int i = 0;i < h;i++){
                        for(int j = 0;j < w;j++){
                            count += board[i][j];
                        }
                    }
                    mint ad = count;
                    ad /= mint(h-a+1)*mint(w-b+1);
                    ad /= mint(h-a+1)*mint(w-b+1);
                    ans += ad;
                }
            }
        }
    }
    cout << ans.val() << endl;
}
0