結果

問題 No.1532 Different Products
ユーザー SSRSSSRS
提出日時 2021-06-04 20:17:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,128 bytes
コンパイル時間 1,945 ms
コンパイル使用メモリ 174,960 KB
実行使用メモリ 324,820 KB
最終ジャッジ日時 2023-08-12 09:08:56
合計ジャッジ時間 78,445 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 358 ms
55,220 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 514 ms
74,616 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 468 ms
65,584 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 612 ms
85,664 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 140 ms
22,516 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 1 ms
4,380 KB
testcase_62 AC 1 ms
4,380 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, pair<long long, long long>>> quotient_ranges(long long N){
	vector<pair<long long, pair<long long, long long>>> ans;
	for (long long i = 1; i * i <= N; i++){
		ans.push_back(make_pair(N / i, make_pair(i, i)));
	}
	for (long long i = N / ((long long) sqrt(N) + 1); i >= 1; i--){
		ans.push_back(make_pair(i, make_pair(N / (i + 1) + 1, N / i)));
	}
	return ans;
}
int main(){
  int N;
  long long K;
  cin >> N >> K;
  vector<pair<long long, pair<long long, long long>>> R = quotient_ranges(K);
  reverse(R.begin(), R.end());
  int M = R.size();
  vector<vector<long long>> dp(N + 1, vector<long long>(M, 0));
  dp[0][M - 1] = 1;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < M; j++){
      dp[i + 1][j] += dp[i][j];
      long long x = R[j].first / (i + 1);
      if (x > 0){
        int p = lower_bound(R.begin(), R.end(), make_pair(x, make_pair((long long) -1, (long long) -1))) - R.begin();
        dp[i + 1][p] += dp[i][j];
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= M; i++){
    ans += dp[N][i];
  }
  ans--;
  cout << ans << endl;
}
0