結果
問題 | No.1492 01文字列と転倒 |
ユーザー |
![]() |
提出日時 | 2023-09-03 14:53:21 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 743 bytes |
コンパイル時間 | 6,020 ms |
コンパイル使用メモリ | 312,920 KB |
実行使用メモリ | 26,144 KB |
最終ジャッジ日時 | 2024-06-12 20:37:05 |
合計ジャッジ時間 | 11,815 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 TLE * 4 |
ソースコード
#include<bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using mint=modint1000000007;using ll=long long;using pp=pair<int,int>;#define sr string#define vc vector#define fi first#define se second#define rep(i,n) for(int i=0;i<(int)n;i++)#define pb push_back#define all(v) v.begin(),v.end()#define pque priority_queue#define bpc(a) __builtin_popcount(a)int main(){ll n,m;cin>>n>>m;vc dp(n+1,vc<ll>(n*n+1,0)); dp[0][0]=1;rep(z,2*n){vc pre(n+1,vc<ll>(n*n+1,0)); swap(pre,dp);rep(i,n+1)rep(j,n*n+1){if(j+(z-i)/2<=n*n&&i+1<=n)dp[i+1][j+(z-i)/2]=(dp[i+1][j+(z-i)/2]+pre[i][j])%m;if(i)dp[i-1][j]=(dp[i-1][j]+pre[i][j])%m;}}rep(i,n*n+1)cout<<dp[0][i]<<"\n";}