結果

問題 No.1492 01文字列と転倒
ユーザー umezoumezo
提出日時 2021-04-30 23:50:59
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,503 ms / 4,000 ms
コード長 562 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 198,832 KB
実行使用メモリ 436,644 KB
最終ジャッジ日時 2023-09-26 08:59:24
合計ジャッジ時間 15,776 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1,503 ms
436,596 KB
testcase_03 AC 1,373 ms
405,348 KB
testcase_04 AC 1,268 ms
375,060 KB
testcase_05 AC 1,068 ms
319,832 KB
testcase_06 AC 1,113 ms
333,000 KB
testcase_07 AC 1,215 ms
360,608 KB
testcase_08 AC 1,487 ms
436,644 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 1,116 ms
333,068 KB
testcase_15 AC 6 ms
5,288 KB
testcase_16 AC 28 ms
13,584 KB
testcase_17 AC 1,069 ms
319,824 KB
testcase_18 AC 31 ms
14,480 KB
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 21 ms
11,108 KB
testcase_21 AC 893 ms
271,216 KB
testcase_22 AC 28 ms
13,552 KB
testcase_23 AC 14 ms
8,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

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

ll dp[210][110][10010];

int main(){
  ll n,m;
  cin>>n>>m;
  
  dp[0][0][0]=1;
  for(int i=0;i<2*n;i++){
    for(int j=0;j<=i/2;j++){
      int t=(i/2)*(i/2);
      for(int k=0;k<=t;k++){
        if(k+j<=n*n) dp[i+1][j][k+j]=(dp[i+1][j][k+j]+dp[i][j][k])%m;
        if(i>=2*j+1) dp[i+1][j+1][k]=(dp[i+1][j+1][k]+dp[i][j][k])%m;
      }
    }
  }
  for(int k=0;k<=n*n;k++) cout<<dp[2*n][n][k]<<endl;

  return 0;
}
0