結果

問題 No.1492 01文字列と転倒
ユーザー chocoruskchocorusk
提出日時 2021-04-30 21:37:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 582 ms / 4,000 ms
コード長 1,233 bytes
コンパイル時間 3,168 ms
コンパイル使用メモリ 187,148 KB
実行使用メモリ 240,388 KB
最終ジャッジ日時 2023-09-26 05:26:29
合計ジャッジ時間 8,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 582 ms
240,388 KB
testcase_03 AC 510 ms
224,460 KB
testcase_04 AC 472 ms
209,132 KB
testcase_05 AC 407 ms
180,192 KB
testcase_06 AC 420 ms
186,964 KB
testcase_07 AC 455 ms
201,552 KB
testcase_08 AC 551 ms
240,280 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 421 ms
186,916 KB
testcase_15 AC 5 ms
5,292 KB
testcase_16 AC 16 ms
11,188 KB
testcase_17 AC 403 ms
179,956 KB
testcase_18 AC 17 ms
11,600 KB
testcase_19 AC 3 ms
4,384 KB
testcase_20 AC 13 ms
9,368 KB
testcase_21 AC 365 ms
153,988 KB
testcase_22 AC 18 ms
11,000 KB
testcase_23 AC 10 ms
7,680 KB
権限があれば一括ダウンロードができます

ソースコード

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