結果

問題 No.1771 A DELETEQ
ユーザー pockynypockyny
提出日時 2021-12-03 19:35:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,589 ms / 3,500 ms
コード長 1,123 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 70,020 KB
実行使用メモリ 504,860 KB
最終ジャッジ日時 2023-09-20 05:40:22
合計ジャッジ時間 13,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1,589 ms
504,860 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1,460 ms
504,724 KB
testcase_05 AC 1,455 ms
502,768 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 22 ms
19,644 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 249 ms
89,688 KB
testcase_10 AC 210 ms
80,692 KB
testcase_11 AC 154 ms
57,848 KB
testcase_12 AC 140 ms
53,400 KB
testcase_13 AC 186 ms
72,352 KB
testcase_14 AC 512 ms
182,820 KB
testcase_15 AC 724 ms
254,296 KB
testcase_16 AC 735 ms
259,824 KB
testcase_17 AC 57 ms
27,288 KB
testcase_18 AC 243 ms
87,268 KB
testcase_19 AC 17 ms
8,944 KB
testcase_20 AC 491 ms
177,772 KB
testcase_21 AC 71 ms
31,280 KB
testcase_22 AC 176 ms
65,880 KB
testcase_23 AC 245 ms
91,976 KB
testcase_24 AC 55 ms
22,772 KB
testcase_25 AC 28 ms
12,816 KB
testcase_26 AC 440 ms
155,428 KB
testcase_27 AC 148 ms
54,376 KB
testcase_28 AC 40 ms
17,000 KB
evil_hand_1.txt RE -
evil_hand_2.txt RE -
evil_hand_3.txt RE -
evil_random_1.txt RE -
evil_random_2.txt RE -
evil_random_3.txt RE -
evil_random_4.txt RE -
evil_random_5.txt RE -
evil_random_6.txt RE -
evil_random_7.txt RE -
evil_random_8.txt RE -
evil_random_9.txt RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
typedef long long ll;
ll dp[4010][4010][2][2] = {},mod = 998244353;
int main(){
    int i,j,x,y; cin >> x >> y;
    if(x>4000 || y>4000) exit(1);
    dp[0][0][0][1] = dp[0][0][1][1] = 1;
    for(i=0;i<=x;i++){
        for(j=0;j<=y;j++){
            (dp[i + 1][j][0][0] += dp[i][j][0][0] + dp[i][j][0][1]) %= mod;
            (dp[i][j + 1][1][0] += dp[i][j][0][0] + dp[i][j][0][1]) %= mod;
            (dp[i][j + 1][1][1] += dp[i][j][0][0]) %= mod;
            (dp[i][j + 1][1][0] += dp[i][j][1][0] + dp[i][j][1][1]) %= mod;
            (dp[i + 1][j][0][0] += dp[i][j][1][0] + dp[i][j][1][1]) %= mod;
            (dp[i + 1][j][0][1] += dp[i][j][1][0]) %= mod;
        }
    }
    ll ans = 0;
    for(i=0;i<=min(x,y);i++) (ans += dp[x - i][y - i][0][0] + dp[x - i][y - i][0][1] + dp[x - i][y - i][1][0] + dp[x - i][y - i][1][1]) %= mod;
    (ans *= (mod + 1)/2) %= mod;
    cout << ans << endl;
    /*for(i=0;i<=min(x,y);i++){
        cout << dp[x - i][y - i][0][0] << " " << dp[x - i][y - i][0][1] << " " << dp[x - i][y - i][1][0] << " " << dp[x - i][y - i][1][1] << endl;
    }*/
}
0