結果

問題 No.1532 Different Products
ユーザー 👑 NachiaNachia
提出日時 2021-06-04 20:27:06
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 412 ms / 4,000 ms
コード長 1,001 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 77,276 KB
実行使用メモリ 4,740 KB
最終ジャッジ日時 2023-08-12 09:30:26
合計ジャッジ時間 18,350 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 114 ms
4,384 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,512 KB
testcase_06 AC 15 ms
4,384 KB
testcase_07 AC 21 ms
4,380 KB
testcase_08 AC 23 ms
4,380 KB
testcase_09 AC 50 ms
4,380 KB
testcase_10 AC 110 ms
4,380 KB
testcase_11 AC 94 ms
4,384 KB
testcase_12 AC 212 ms
4,384 KB
testcase_13 AC 143 ms
4,380 KB
testcase_14 AC 348 ms
4,380 KB
testcase_15 AC 33 ms
4,380 KB
testcase_16 AC 165 ms
4,384 KB
testcase_17 AC 98 ms
4,388 KB
testcase_18 AC 79 ms
4,452 KB
testcase_19 AC 197 ms
4,416 KB
testcase_20 AC 343 ms
4,384 KB
testcase_21 AC 187 ms
4,384 KB
testcase_22 AC 140 ms
4,424 KB
testcase_23 AC 99 ms
4,380 KB
testcase_24 AC 313 ms
4,384 KB
testcase_25 AC 198 ms
4,380 KB
testcase_26 AC 63 ms
4,380 KB
testcase_27 AC 215 ms
4,380 KB
testcase_28 AC 164 ms
4,384 KB
testcase_29 AC 209 ms
4,380 KB
testcase_30 AC 255 ms
4,384 KB
testcase_31 AC 254 ms
4,380 KB
testcase_32 AC 273 ms
4,380 KB
testcase_33 AC 240 ms
4,380 KB
testcase_34 AC 307 ms
4,384 KB
testcase_35 AC 271 ms
4,380 KB
testcase_36 AC 303 ms
4,380 KB
testcase_37 AC 205 ms
4,380 KB
testcase_38 AC 316 ms
4,416 KB
testcase_39 AC 289 ms
4,384 KB
testcase_40 AC 294 ms
4,380 KB
testcase_41 AC 398 ms
4,544 KB
testcase_42 AC 358 ms
4,432 KB
testcase_43 AC 372 ms
4,544 KB
testcase_44 AC 400 ms
4,548 KB
testcase_45 AC 405 ms
4,700 KB
testcase_46 AC 391 ms
4,588 KB
testcase_47 AC 412 ms
4,552 KB
testcase_48 AC 405 ms
4,668 KB
testcase_49 AC 404 ms
4,672 KB
testcase_50 AC 403 ms
4,680 KB
testcase_51 AC 407 ms
4,628 KB
testcase_52 AC 401 ms
4,588 KB
testcase_53 AC 407 ms
4,676 KB
testcase_54 AC 403 ms
4,544 KB
testcase_55 AC 409 ms
4,732 KB
testcase_56 AC 394 ms
4,544 KB
testcase_57 AC 397 ms
4,716 KB
testcase_58 AC 404 ms
4,712 KB
testcase_59 AC 384 ms
4,740 KB
testcase_60 AC 409 ms
4,692 KB
testcase_61 AC 2 ms
4,380 KB
testcase_62 AC 1 ms
4,380 KB
testcase_63 AC 405 ms
4,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ll N, K;
vector<ll> dp_fairy;
vector<ll> dp_devil;

int main(){
  cin >> N >> K;
  ll fairy_count = min(K,100000ll);
  dp_fairy.assign(fairy_count+1,0);
  ll devil_count = (K+fairy_count-1) / fairy_count;
  dp_devil.assign(devil_count+1,0);
  dp_devil[1] = 1;

  for(int a=1; a<=N; a++){
    for(ll i=a; i<=fairy_count; i++){
      dp_fairy[i/a] += dp_fairy[i];
    }
    for(ll i=devil_count; i>=1; i--){
      if(i*a <= devil_count) dp_devil[i*a] += dp_devil[i];
      else dp_fairy[K/(i*a)] += dp_devil[i];
    }
  }

  ll ans = 0;
  for(ll i=1; i<=fairy_count; i++) ans += dp_fairy[i];
  for(ll i=0; i<=devil_count; i++) ans += dp_devil[i];

  cout << (ans-1) << "\n";
  return 0;
}



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


0