結果
問題 | No.1492 01文字列と転倒 |
ユーザー |
![]() |
提出日時 | 2023-06-19 00:31:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 742 bytes |
コンパイル時間 | 1,937 ms |
コンパイル使用メモリ | 198,240 KB |
最終ジャッジ日時 | 2025-02-14 22:48:38 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 TLE * 2 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){ll N, M;cin >> N >> M;vector<vector<ll>> dp(N+1, vector<ll>(N*N+1));dp[0][0] = 1;for (int i=1; i<=N*2; i++){vector<vector<ll>> pd(N+1, vector<ll>(N*N+1));for (int j=0; j<=N; j++){for (int k=0; k<=N*N; k++){if (k+j<=N*N){pd[j][k+j] += dp[j][k];pd[j][k+j] %= M;}if (j+1<=N && i>=j*2+2){pd[j+1][k] += dp[j][k];pd[j+1][k] %= M;}}}swap(dp, pd);}for (int i=0; i<=N*N; i++) cout << dp[N][i] << endl;return 0;}