結果

問題 No.1492 01文字列と転倒
ユーザー simansiman
提出日時 2023-01-19 21:23:45
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 920 bytes
コンパイル時間 4,074 ms
コンパイル使用メモリ 102,352 KB
実行使用メモリ 19,220 KB
最終ジャッジ日時 2023-09-04 13:59:14
合計ジャッジ時間 10,299 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

int main() {
  int N, M;
  cin >> N >> M;

  ll dp[N + 1][N * N + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;

  for (int i = 0; i < 2 * N; ++i) {
    ll temp[N + 1][N * N + 1];
    memset(temp, 0, sizeof(temp));

    for (int zc = 0; zc <= N; ++zc) {
      int oc = i - zc;
      if (oc > zc) continue;

      for (int k = 0; k < N * N; ++k) {
        if (oc + 1 <= zc) {
          temp[zc][k] += dp[zc][k];
        }
        if (zc + 1 <= N) {
          temp[zc + 1][k + oc] += dp[zc][k];
        }
      }
    }

    memcpy(dp, temp, sizeof(temp));
  }

  for (int k = 0; k <= N * N; ++k) {
    cout << dp[N][k] << endl;
  }

  return 0;
}
0