結果

問題 No.1492 01文字列と転倒
ユーザー hir355hir355
提出日時 2021-04-30 21:55:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,698 bytes
コンパイル時間 2,071 ms
コンパイル使用メモリ 199,904 KB
実行使用メモリ 11,528 KB
最終ジャッジ日時 2023-09-26 05:58:40
合計ジャッジ時間 5,794 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
const long long INF_LL = 2000000000000000000LL;
const int INF = 2000000000;
const long long MOD = 1000000007;
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < (int)b; i++)
#define rep(i, n) REP(i, 0, n)
// typedef float double;
// typedef priority_queue prique;P
typedef pair<ll, ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vi> matrix;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll b, ll m) {
    if(b == 0)
        return 1;
    ll t = modpow(a, b / 2, m);
    if(b & 1) {
        return (t * t % m) * a % m;
    } else {
        return t * t % m;
    }
}

struct edge {
    int to;
    ll cost;
    edge(int t, ll c) { to = t, cost = c; }
};

typedef vector<vector<edge>> graph;

modint dp[2][101][10001];

int main(){
    int n, m;
    cin >> n >> m;
    modint::set_mod(m);
    dp[0][0][0] = 1;
    rep(i, n * 2){
        rep(j, n + 1){
            if(j > 0){
                rep(k, n * n + 1) dp[(i + 1) & 1][j - 1][k] += dp[i & 1][j][k];
            }
            if(j < n){
                REP(k, (i - j) / 2, n * n + 1) dp[(i + 1) & 1][j + 1][k] = dp[i & 1][j][k - (i - j) / 2];
            }
        }
    }
    rep(i, n * n + 1){
        cout << dp[0][0][i].val() << endl;
    }
    return 0;
}
0