結果
| 問題 |
No.2156 ぞい文字列
|
| コンテスト | |
| ユーザー |
kotamanegi
|
| 提出日時 | 2022-12-05 22:10:47 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 772 bytes |
| コンパイル時間 | 2,994 ms |
| コンパイル使用メモリ | 166,520 KB |
| 実行使用メモリ | 816,256 KB |
| 最終ジャッジ日時 | 2024-10-12 18:46:23 |
| 合計ジャッジ時間 | 5,890 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | MLE * 1 -- * 15 |
コンパイルメッセージ
main.cpp:1:17: warning: using directive refers to implicitly-defined namespace 'std'
1 | using namespace std;
| ^
1 warning generated.
ソースコード
using namespace std;
#include "bits/stdc++.h"
#define REP(a, b) for (long long a = 0; a < b; ++a)
#define ALL(a) begin(a), end(a)
#include "atcoder/modint.hpp"
using mint = atcoder::modint998244353;
#define ld long double
#define int long long
map<int, mint> dp;
mint f(int x)
{
if (dp.count(x))
return dp[x];
return dp[x] = f(x - 1) + f(x - 2);
}
void solve()
{
dp[1] = 1;
dp[2] = 1;
int n;
cin >> n;
cout << (f(n + 1) - 1).val() << endl;
}
#undef int
int main()
{
// Fasterize input/output script
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(100);
int t = 1;
// cin >> t; // comment out if solving multi testcase
for (int testCase = 1; testCase <= t; ++testCase)
{
solve();
}
return 0;
}
kotamanegi