結果

問題 No.1772 Many DELETEQs
ユーザー KudeKude
提出日時 2021-12-03 05:53:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 172 ms / 3,500 ms
コード長 1,125 bytes
コンパイル時間 2,585 ms
コンパイル使用メモリ 222,084 KB
実行使用メモリ 66,088 KB
最終ジャッジ日時 2023-09-18 20:05:54
合計ジャッジ時間 4,878 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
65,916 KB
testcase_01 AC 107 ms
65,952 KB
testcase_02 AC 107 ms
66,088 KB
testcase_03 AC 171 ms
65,932 KB
testcase_04 AC 170 ms
65,916 KB
testcase_05 AC 172 ms
65,900 KB
testcase_06 AC 149 ms
65,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic pop
using namespace std;
using namespace atcoder;
#define rep(i,n)for (int i = 0; i < int(n); ++i)
#define rrep(i,n)for (int i = int(n)-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
template<class T> void chmax(T& a, const T& b) { a = max(a, b); }
template<class T> void chmin(T& a, const T& b) { a = min(a, b); }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using mint = modint998244353;

constexpr int MX = 4002;
mint dp[MX][MX];

} int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  dp[0][0] = 1;
  rep(i, MX - 1) rep(j, MX - 1) {
    mint v = dp[i][j];
    dp[i + 1][j] += v;
    dp[i][j + 1] += v;
    dp[i + 1][j + 1] += 2 * v;
  }
  rep(i, MX - 1) rep(j, MX - 1) dp[i + 1][j + 1] += dp[i][j];
  int q;
  cin >> q;
  while(q--) {
    int x, y;
    cin >> x >> y;
    cout << dp[x][y].val() << '\n';
  }
}
0