結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2020-11-02 21:57:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 714 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 74,240 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-22 08:07:01 |
合計ジャッジ時間 | 1,686 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 WA * 4 |
ソースコード
#include <iostream> #include <vector> #include <queue> using namespace std; using ll = long long; int main() { int x; cin >> x; if (x > 31) { cout << 0 << endl; return 0; } vector<pair<ll, ll>> dp(31); dp[0] = {1, 0}; for (int i = 0; i <= 30; i++) { vector<pair<ll, ll>> after(31); for (int j = 0; j <= 30; j++) { after[j].first += dp[j].first, after[j].second += dp[j].second * 2; if (j > 0) { after[j].first += dp[j - 1].first, after[j].second += dp[j - 1].second * 2 + dp[j - 1].first; } } dp = after; } cout << dp[x].first << " " << dp[x].second << endl; return 0; }