結果

問題 No.1492 01文字列と転倒
ユーザー zuminzumin
提出日時 2021-05-01 00:55:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2,095 ms / 4,000 ms
コード長 1,182 bytes
コンパイル時間 8,210 ms
コンパイル使用メモリ 284,060 KB
実行使用メモリ 27,272 KB
最終ジャッジ日時 2023-09-26 09:57:47
合計ジャッジ時間 26,825 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
26,960 KB
testcase_01 AC 14 ms
27,016 KB
testcase_02 AC 2,087 ms
27,004 KB
testcase_03 AC 1,994 ms
26,964 KB
testcase_04 AC 1,834 ms
26,944 KB
testcase_05 AC 1,617 ms
27,148 KB
testcase_06 AC 1,641 ms
27,008 KB
testcase_07 AC 1,782 ms
26,948 KB
testcase_08 AC 2,095 ms
26,944 KB
testcase_09 AC 25 ms
27,004 KB
testcase_10 AC 14 ms
27,272 KB
testcase_11 AC 22 ms
26,964 KB
testcase_12 AC 20 ms
26,952 KB
testcase_13 AC 16 ms
27,268 KB
testcase_14 AC 1,643 ms
26,948 KB
testcase_15 AC 55 ms
26,968 KB
testcase_16 AC 112 ms
26,952 KB
testcase_17 AC 1,567 ms
26,964 KB
testcase_18 AC 125 ms
26,952 KB
testcase_19 AC 45 ms
27,016 KB
testcase_20 AC 102 ms
27,020 KB
testcase_21 AC 1,354 ms
26,964 KB
testcase_22 AC 108 ms
27,024 KB
testcase_23 AC 78 ms
26,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#include <boost/algorithm/string.hpp>

using namespace std;
using namespace atcoder;

typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int n,m;
    cin>>n>>m;
    static int dp[2][201][10001]={0},z[201][10001]={0};
    dp[0][0][0]=1;

    REP(i,2*n){
        REP(j,2*n+1){
            REP(k,n*n+1){
                if(j>=1&&((i^(j-1))&1)==0&&(2*k>=(i-j+1))){
                    dp[(i+1)&1][j][k]+=dp[i&1][j-1][k-(i-j+1)/2];
                    dp[(i+1)&1][j][k]%=m;
                }
                if(j<=i){
                    dp[(i+1)&1][j][k]+=dp[i&1][j+1][k];
                    dp[(i+1)&1][j][k]%=m;
                }
            }
        }
        memcpy(dp[i&1],z,sizeof(z));
    }
    REP(k,n*n+1){
        cout<<dp[(2*n)&1][0][k]<<endl;
    }
}
0