結果

問題 No.2156 ぞい文字列
ユーザー kotamanegikotamanegi
提出日時 2022-12-05 22:10:47
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 772 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 167,296 KB
実行使用メモリ 813,312 KB
最終ジャッジ日時 2024-04-20 20:40:05
合計ジャッジ時間 6,201 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:1:17: warning: using directive refers to implicitly-defined namespace 'std'
    1 | using namespace std;
      |                 ^
1 warning generated.

ソースコード

diff #

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;
}
0