結果

問題 No.1492 01文字列と転倒
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-03 14:53:21
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 5,923 ms
コンパイル使用メモリ 308,948 KB
実行使用メモリ 23,636 KB
最終ジャッジ日時 2023-09-03 14:53:34
合計ジャッジ時間 11,385 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  ll n,m;cin>>n>>m;
  vc dp(n+1,vc<ll>(n*n+1,0)); dp[0][0]=1;
  rep(z,2*n){
    vc pre(n+1,vc<ll>(n*n+1,0)); swap(pre,dp);
    rep(i,n+1)rep(j,n*n+1){
      if(j+(z-i)/2<=n*n&&i+1<=n)dp[i+1][j+(z-i)/2]=(dp[i+1][j+(z-i)/2]+pre[i][j])%m;
      if(i)dp[i-1][j]=(dp[i-1][j]+pre[i][j])%m;
    }
  }
  rep(i,n*n+1)cout<<dp[0][i]<<"\n";
}
0