結果

問題 No.1492 01文字列と転倒
ユーザー chocoruskchocorusk
提出日時 2021-04-30 21:37:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 814 ms / 4,000 ms
コード長 1,233 bytes
コンパイル時間 4,757 ms
コンパイル使用メモリ 180,536 KB
最終ジャッジ日時 2025-01-21 02:38:23
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
int m;
int n;
int dp[202][101][10001];
int main()
{
    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 x=i-j, y=j;
            for(int k=0; k<=(i/2)*((i+1)/2); k++){
                if(x+1>=y && k+y<=10000){
                    dp[i+1][j][k+y]+=dp[i][j][k];
                    dp[i+1][j][k+y]%=m;
                }
                if(x>=y+1){
                    dp[i+1][j+1][k]+=dp[i][j][k];
                    dp[i+1][j+1][k]%=m;
                }
            }
        }
    }
    for(int k=0; k<=n*n; k++){
        cout<<dp[2*n][n][k]<<endl;
    }
    return 0;
}
0