結果

問題 No.1532 Different Products
ユーザー SSRSSSRS
提出日時 2021-06-04 20:19:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,127 bytes
コンパイル時間 1,690 ms
コンパイル使用メモリ 174,920 KB
実行使用メモリ 325,036 KB
最終ジャッジ日時 2023-08-12 09:13:11
合計ジャッジ時間 78,638 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 361 ms
55,048 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 20 ms
5,484 KB
testcase_09 AC 213 ms
31,232 KB
testcase_10 AC 517 ms
74,840 KB
testcase_11 AC 417 ms
61,004 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 248 ms
35,176 KB
testcase_16 WA -
testcase_17 AC 511 ms
71,404 KB
testcase_18 AC 476 ms
66,812 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 621 ms
86,136 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 141 ms
22,524 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 AC 213 ms
37,828 KB
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 2 ms
4,384 KB
testcase_62 AC 2 ms
4,376 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