結果

問題 No.1581 Multiple Sequence
ユーザー 👑 NachiaNachia
提出日時 2021-07-02 23:20:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 77,748 KB
実行使用メモリ 14,168 KB
最終ジャッジ日時 2023-09-11 23:48:13
合計ジャッジ時間 2,583 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 51 ms
12,336 KB
testcase_03 AC 51 ms
13,084 KB
testcase_04 AC 15 ms
6,636 KB
testcase_05 AC 55 ms
13,396 KB
testcase_06 AC 24 ms
8,300 KB
testcase_07 AC 14 ms
6,148 KB
testcase_08 AC 18 ms
7,220 KB
testcase_09 AC 49 ms
12,600 KB
testcase_10 AC 30 ms
9,808 KB
testcase_11 AC 8 ms
4,924 KB
testcase_12 AC 20 ms
7,596 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 53 ms
13,248 KB
testcase_15 AC 36 ms
10,708 KB
testcase_16 AC 9 ms
5,168 KB
testcase_17 AC 60 ms
13,816 KB
testcase_18 AC 7 ms
4,760 KB
testcase_19 AC 44 ms
11,952 KB
testcase_20 AC 47 ms
12,216 KB
testcase_21 AC 53 ms
12,764 KB
testcase_22 AC 28 ms
9,060 KB
testcase_23 AC 65 ms
14,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)


int main(){
  int N; cin >> N;
  vector<vector<int>> E(N+1);
  for(int i=1; i<=N; i++) for(int j=i*2; j<=N; j+=i) E[j].push_back(i-1);
  for(int i=0; i<N; i++) E[i+1].push_back(i);
  vector<ull> dp(N+1,0);
  dp[N] = 1;
  for(int i=N; i>=0; i--){
    dp[i] %= 1000000007;
    for(int e : E[i]) dp[e] += dp[i];
  }
  cout << dp[0] << "\n";
  return 0;
}

struct ios_do_not_sync{
  ios_do_not_sync(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  }
} ios_do_not_sync_inst;
0