結果

問題 No.1492 01文字列と転倒
ユーザー auauaauaua
提出日時 2021-04-30 21:59:39
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,334 ms / 4,000 ms
コード長 1,253 bytes
コンパイル時間 1,709 ms
コンパイル使用メモリ 169,136 KB
実行使用メモリ 11,076 KB
最終ジャッジ日時 2023-09-26 06:04:23
合計ジャッジ時間 21,883 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2,334 ms
11,000 KB
testcase_03 AC 2,151 ms
10,384 KB
testcase_04 AC 1,982 ms
10,424 KB
testcase_05 AC 1,665 ms
9,168 KB
testcase_06 AC 1,742 ms
9,440 KB
testcase_07 AC 1,909 ms
9,996 KB
testcase_08 AC 2,334 ms
11,076 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1,743 ms
9,444 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 33 ms
4,376 KB
testcase_17 AC 1,669 ms
9,396 KB
testcase_18 AC 37 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 23 ms
4,380 KB
testcase_21 AC 1,389 ms
8,264 KB
testcase_22 AC 33 ms
4,380 KB
testcase_23 AC 14 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll MOD=INF;
const ll inf=INF*INF;
ll mod=MOD;
const ll MAX=100010;



signed main(){
    ll n,m;cin>>n>>m;
    vector<vector<int> >dp(n+1,vector<int>(n*n+1));
    vector<vector<int> >dp1(n+1,vector<int>(n*n+1));
    dp[0][0]=1;
    rep(i,2*n){
        rep(j,n+1){
            rep(k,n*n+1){
                if(i-j<j)continue;
                if(j<n){
                    dp1[j+1][k]=(dp1[j+1][k]+dp[j][k])%m;
                }
                if(k+j<=n*n)dp1[j][k+j]=(dp1[j][k+j]+dp[j][k])%m;
            }
        }
        swap(dp,dp1);
        rep(j,n+1){
            rep(k,n*n+1){
                dp1[j][k]=0;
            }
        }
    }
    rep(i,n*n+1){
        cout<<dp[n][i]<<endl;
    }
}
0