結果
問題 | No.1492 01文字列と転倒 |
ユーザー |
![]() |
提出日時 | 2021-04-30 22:22:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 142 ms / 4,000 ms |
コード長 | 1,045 bytes |
コンパイル時間 | 2,230 ms |
コンパイル使用メモリ | 183,800 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-07-19 01:50:43 |
合計ジャッジ時間 | 4,171 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#pragma GCC optimize ("O2") #pragma GCC target ("avx") #include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) #define Would #define you #define please int mod; int dp[2][105][10100]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N >> mod; auto mae = dp[0]; auto ato = dp[1]; mae[0][0] = 1; rep(i, N) { rep(j, i + 2) for (int k = i * i; k >= 0; k--) { (ato[j][k + j] += mae[j][k]) %= mod; if (j != 0) { (ato[j][k] += ato[j - 1][k]) %= mod; } } swap(mae, ato); rep(j, i + 2) rep(k, i * i + 1) ato[j][k] = 0; } rep(i, N * N + 1) { co(mae[N][i]); } Would you please return 0; }