結果

問題 No.1532 Different Products
ユーザー 👑 potato167potato167
提出日時 2021-06-04 21:06:24
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 739 ms / 4,000 ms
コード長 2,476 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 217,080 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-08-12 10:48:12
合計ジャッジ時間 29,102 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 147 ms
8,148 KB
testcase_02 AC 14 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 21 ms
4,380 KB
testcase_08 AC 86 ms
5,136 KB
testcase_09 AC 110 ms
7,956 KB
testcase_10 AC 141 ms
11,716 KB
testcase_11 AC 123 ms
11,652 KB
testcase_12 AC 293 ms
12,552 KB
testcase_13 AC 154 ms
11,732 KB
testcase_14 AC 595 ms
13,748 KB
testcase_15 AC 31 ms
5,080 KB
testcase_16 AC 181 ms
8,376 KB
testcase_17 AC 132 ms
11,584 KB
testcase_18 AC 118 ms
12,068 KB
testcase_19 AC 259 ms
12,964 KB
testcase_20 AC 565 ms
13,924 KB
testcase_21 AC 237 ms
8,628 KB
testcase_22 AC 173 ms
12,708 KB
testcase_23 AC 126 ms
12,840 KB
testcase_24 AC 534 ms
13,152 KB
testcase_25 AC 301 ms
12,164 KB
testcase_26 AC 105 ms
8,584 KB
testcase_27 AC 323 ms
9,204 KB
testcase_28 AC 230 ms
11,964 KB
testcase_29 AC 233 ms
7,928 KB
testcase_30 AC 412 ms
11,500 KB
testcase_31 AC 410 ms
12,060 KB
testcase_32 AC 453 ms
11,948 KB
testcase_33 AC 368 ms
12,408 KB
testcase_34 AC 525 ms
12,600 KB
testcase_35 AC 461 ms
12,564 KB
testcase_36 AC 543 ms
12,600 KB
testcase_37 AC 156 ms
7,520 KB
testcase_38 AC 550 ms
13,336 KB
testcase_39 AC 512 ms
13,320 KB
testcase_40 AC 507 ms
12,104 KB
testcase_41 AC 678 ms
15,324 KB
testcase_42 AC 628 ms
13,324 KB
testcase_43 AC 654 ms
14,312 KB
testcase_44 AC 699 ms
13,532 KB
testcase_45 AC 703 ms
13,984 KB
testcase_46 AC 735 ms
14,576 KB
testcase_47 AC 716 ms
13,816 KB
testcase_48 AC 688 ms
13,976 KB
testcase_49 AC 686 ms
14,296 KB
testcase_50 AC 691 ms
14,128 KB
testcase_51 AC 697 ms
13,548 KB
testcase_52 AC 683 ms
13,624 KB
testcase_53 AC 701 ms
15,208 KB
testcase_54 AC 688 ms
14,132 KB
testcase_55 AC 686 ms
13,988 KB
testcase_56 AC 725 ms
14,460 KB
testcase_57 AC 720 ms
13,844 KB
testcase_58 AC 739 ms
14,192 KB
testcase_59 AC 718 ms
14,484 KB
testcase_60 AC 727 ms
14,248 KB
testcase_61 AC 1 ms
4,376 KB
testcase_62 AC 1 ms
4,380 KB
testcase_63 AC 713 ms
14,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using std::cout;
using std::cin;
using std::endl;
using ll=long long;
using ld=long double;
ll I=1167167167167167167;
ll Q=998244353;
#define rep(i,a) for (ll i=0;i<a;i++)
template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>;
template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());}
template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});}
template<class T> void print_tate(vector<T> &v) {rep(i,v.size()) cout<<v[i]<<"\n";}
void yneos(bool a){if(a) cout<<"Yes"<<"\n"; else cout<<"No"<<"\n";}


//a以下の素数を列挙、計算量:Nlog(log(N))
vector<long long> Eratosthenes(long long a){
    if(a<2) return {};
    vector<long long> p(a+1),ans;
    p[0]=1,p[1]=1;
    long long k=2;
    while(k*k<=a){
        if(p[k]==0){
            ans.push_back(k);
            for(long long i=2;i*k<=a;i++){
                p[i*k]=1;
            }
        }
        k++;
    }
    while(k<=a){
        if(p[k]==0) ans.push_back(k);
        k++;
    }
    return ans;
}


//Nの正の約数を列挙する
vector<long long> Divisors(long long N){
    vector<long long> p,q;
    long long i=1,K=0;
    while(i*i<N){
        if(N%i==0){
            p.push_back(i);
            q.push_back(N/i);
            K++;
        }
        i++;
    }
    if(i*i==N) p.push_back(i);
    for(int i=K-1;i>=0;i--){
        p.push_back(q[i]);
    }
    return p;
}

//おちこんだりもしたけれど、私はげんきです。
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll N,K;
	cin>>N>>K;

	chmin(N,K);
	int D=9;
	vector<map<ll,ll>> m(D);
	m[0][K]=1;
	vector<ll> p;
	int M=min(20ll,N);
	rep(i,(1<<M)){
		ll X=1;
		rep(j,M){
			if(i&(1<<j)) X*=(j+1);
			if(X>K) break;
		}
		if(X<=K) p.push_back(X);
	}
	p.push_back(I);
	So(p);
	for(ll i=M+1;i<=N;i++){
		for(int j=D-1;j>=0;j--){
			for(auto x:m[j]){
				if(x.first>=i){
					m[j+1][x.first/i]+=x.second;
				}
			}
		}
	}
	ll ans=0;
	rep(i,D){
		for(auto x:m[i]){
			ans+=(ll)UB(p,x.first)*x.second;
		}
	}
	cout<<ans-1<<"\n";
}
0