結果

問題 No.1973 Divisor Sequence
ユーザー renren_utsrenren_uts
提出日時 2022-06-16 07:21:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 753 ms / 2,000 ms
コード長 1,613 bytes
コンパイル時間 1,359 ms
コンパイル使用メモリ 112,664 KB
実行使用メモリ 179,780 KB
最終ジャッジ日時 2024-04-15 17:34:48
合計ジャッジ時間 7,021 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 195 ms
30,660 KB
testcase_03 AC 158 ms
6,944 KB
testcase_04 AC 177 ms
19,396 KB
testcase_05 AC 174 ms
17,236 KB
testcase_06 AC 188 ms
25,824 KB
testcase_07 AC 160 ms
7,628 KB
testcase_08 AC 172 ms
15,432 KB
testcase_09 AC 172 ms
17,348 KB
testcase_10 AC 204 ms
20,904 KB
testcase_11 AC 156 ms
6,940 KB
testcase_12 AC 181 ms
21,432 KB
testcase_13 AC 166 ms
8,780 KB
testcase_14 AC 193 ms
18,352 KB
testcase_15 AC 179 ms
22,456 KB
testcase_16 AC 187 ms
26,716 KB
testcase_17 AC 193 ms
17,960 KB
testcase_18 AC 156 ms
6,940 KB
testcase_19 AC 202 ms
22,488 KB
testcase_20 AC 158 ms
6,944 KB
testcase_21 AC 192 ms
31,068 KB
testcase_22 AC 179 ms
22,524 KB
testcase_23 AC 753 ms
179,780 KB
testcase_24 AC 345 ms
46,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:67:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   67 |   for(auto [i,vaku]:mp){
      |            ^

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <tuple>
#include <bitset>
#include <map>
#include <queue>
#include <time.h>
#include <utility>
#include <numeric>
#include <deque>
#include <cassert>
#include <sstream>
#include <cctype>
#include <unordered_map>
#include <algorithm>
#include <chrono>
#define ll long long
#include <time.h>
#define mod % 1000000007
#define rep(i,n) for(long long i = 0;i < n;i ++)
ll MAX = 5'000'000'000'000'000'000LL;
using namespace std;

 vector<ll> p;

void MAKE_P(){
  p = {2,3};
  for(int i = 5;i <= 1000000;i ++){
    bool z = true;
    for(ll j:p){
      if(i%j==0){
        z = false;
        break;
      }
      if(j*j>i)break;
    }
    if(z)p.push_back(i);
  }
}

int main(){
  ll n,m;
  cin >> n >> m;
  if(m==1){
    cout << 1 << endl;
    return 0;
  }
  MAKE_P();
  vector<ll> q;
  rep(i,int(p.size())){
    if(m%p[i]==0){
      q.push_back(0);
      while(m%p[i] == 0){
        q[int(q.size())-1] ++;
        m = m/p[i];
      }
    }
  }
  if(m>1)q.push_back(1);
  map<ll,ll> mp;
  for(int i:q){
    mp[i] = 1;
  }
  vector<ll> ans(50);
  for(auto [i,vaku]:mp){
    if(i==0){
      ans[0] = 1;
      continue;
    }
    vector<vector<ll>> dp(n+1,vector<ll>(i+1,0));
    dp[0][0] = 1;
    rep(j,n){
      rep(k,i+1){
        dp[j][k] = dp[j][k] mod;
        rep(l,i+1){
          if(l+k>i)break;
          dp[j+1][l] += dp[j][k];
        }
      }
    }
    rep(j,i+1)ans[i] += dp[n][j];
    ans[i] = ans[i] mod;
  }
  ll sum = 1;
  rep(i,int(q.size())){
    sum = (sum*ans[q[i]]) mod;
  }
  cout << sum << endl;
  
  return 0;
}
0