結果
| 問題 | No.1771 A DELETEQ | 
| コンテスト | |
| ユーザー |  Nachia | 
| 提出日時 | 2021-12-03 00:27:49 | 
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 82 ms / 3,500 ms | 
| コード長 | 865 bytes | 
| コンパイル時間 | 2,023 ms | 
| コンパイル使用メモリ | 110,972 KB | 
| 最終ジャッジ日時 | 2025-01-26 02:58:39 | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 WA * 12 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)
using m32 = atcoder::modint998244353;
m32 dp[4001][4001];
int main(){
    int x,y; cin >> x >> y;
    if(4000 < x || 4000 < y) exit(0);
    dp[x][y] = 1;
    m32 ans = 0;
    for(int xx=x; xx>=0; xx--) for(int yy=y; yy>=0; yy--){
        m32 p = dp[xx][yy];
        if(xx == yy) ans += p;
        if(xx != 0) dp[xx-1][yy] += p;
        if(yy != 0) dp[xx][yy-1] += p;
        if(xx != 0 && yy != 0) dp[xx-1][yy-1] += p * 2;
    }
    cout << ans.val() << endl;
    return 0;
}
struct ios_do_not_sync {
    ios_do_not_sync() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
            
            
            
        