結果
| 問題 |
No.420 mod2漸化式
|
| コンテスト | |
| ユーザー |
mencotton
|
| 提出日時 | 2020-11-02 22:01:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 709 bytes |
| コンパイル時間 | 2,003 ms |
| コンパイル使用メモリ | 71,936 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 08:07:20 |
| 合計ジャッジ時間 | 1,827 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main() {
int x;
cin >> x;
if (x > 31) {
cout << 0 << " " << 0 << endl;
return 0;
}
vector<pair<ll, ll>> dp(32);
dp[0] = {1, 0};
for (int i = 0; i <= 30; i++) {
vector<pair<ll, ll>> after(32);
for (int j = 0; j <= 31; 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;
}
mencotton