結果
問題 | No.1532 Different Products |
ユーザー | noya2 |
提出日時 | 2021-06-04 21:56:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 4,063 bytes |
コンパイル時間 | 4,743 ms |
コンパイル使用メモリ | 274,304 KB |
実行使用メモリ | 401,920 KB |
最終ジャッジ日時 | 2024-11-19 14:13:03 |
合計ジャッジ時間 | 181,644 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
13,632 KB |
testcase_01 | AC | 641 ms
44,836 KB |
testcase_02 | AC | 3 ms
13,632 KB |
testcase_03 | AC | 3 ms
198,688 KB |
testcase_04 | AC | 2 ms
13,640 KB |
testcase_05 | AC | 2 ms
204,452 KB |
testcase_06 | AC | 2 ms
13,640 KB |
testcase_07 | AC | 3 ms
204,324 KB |
testcase_08 | AC | 3 ms
13,640 KB |
testcase_09 | AC | 50 ms
215,040 KB |
testcase_10 | AC | 798 ms
49,696 KB |
testcase_11 | AC | 492 ms
247,552 KB |
testcase_12 | AC | 2,848 ms
124,196 KB |
testcase_13 | AC | 823 ms
257,920 KB |
testcase_14 | TLE | - |
testcase_15 | AC | 3 ms
223,272 KB |
testcase_16 | AC | 786 ms
53,796 KB |
testcase_17 | AC | 412 ms
245,504 KB |
testcase_18 | AC | 185 ms
22,824 KB |
testcase_19 | AC | 2,585 ms
118,944 KB |
testcase_20 | TLE | - |
testcase_21 | AC | 1,295 ms
72,360 KB |
testcase_22 | AC | 1,205 ms
66,848 KB |
testcase_23 | AC | 291 ms
28,068 KB |
testcase_24 | TLE | - |
testcase_25 | AC | 2,212 ms
316,032 KB |
testcase_26 | AC | 101 ms
18,084 KB |
testcase_27 | AC | 2,030 ms
305,664 KB |
testcase_28 | AC | 1,364 ms
72,992 KB |
testcase_29 | AC | 1,430 ms
285,824 KB |
testcase_30 | AC | 2,750 ms
125,860 KB |
testcase_31 | AC | 2,792 ms
318,720 KB |
testcase_32 | AC | 3,239 ms
142,880 KB |
testcase_33 | AC | 2,420 ms
323,968 KB |
testcase_34 | TLE | - |
testcase_35 | AC | 3,333 ms
351,488 KB |
testcase_36 | TLE | - |
testcase_37 | AC | 798 ms
263,680 KB |
testcase_38 | TLE | - |
testcase_39 | AC | 3,783 ms
379,136 KB |
testcase_40 | AC | 3,917 ms
156,672 KB |
testcase_41 | TLE | - |
testcase_42 | TLE | - |
testcase_43 | TLE | - |
testcase_44 | TLE | - |
testcase_45 | TLE | - |
testcase_46 | TLE | - |
testcase_47 | TLE | - |
testcase_48 | TLE | - |
testcase_49 | TLE | - |
testcase_50 | TLE | - |
testcase_51 | TLE | - |
testcase_52 | TLE | - |
testcase_53 | TLE | - |
testcase_54 | TLE | - |
testcase_55 | TLE | - |
testcase_56 | TLE | - |
testcase_57 | TLE | - |
testcase_58 | TLE | - |
testcase_59 | TLE | - |
testcase_60 | TLE | - |
testcase_61 | AC | 2 ms
6,816 KB |
testcase_62 | AC | 2 ms
6,816 KB |
testcase_63 | TLE | - |
ソースコード
#include <bits/stdc++.h> /* #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; using bint = mp::cpp_int; */ #include <atcoder/all> #include <iostream> #include <queue> #include <stack> #include <vector> #include <string> #include <set> #include <map> #include <random> #include <bitset> #define rep(i,n) for (int i = 0; i < int(n); ++i) #define repp(i,n,m) for (int i = m; i < int(n); ++i) using namespace std; using namespace atcoder; using namespace internal; //alias g++='g++ -I/mnt/c/Users/Owner/Desktop/ac-library' using ll = long long; using ld = long double; using P = pair<int, int>; using PI = pair<pair<int,int>,int>; using PL = pair<long long, long long>; using PLL = pair<pair<long long, long long>, long long>; using Pxy = pair<long double, long double>; const int INF = 1001001007; const int modd = 1000000007; const long long modl = 1000000007LL; const long long mod = 998244353LL; const ll inf = 2e18; template <typename SA> void priv(vector<SA> &ar){ if (ar.size() == 0) cout << endl; else { rep(i,ar.size()-1) cout << ar[i] << " "; cout << ar[ar.size()-1] << endl; } } template <typename SB> void privv(vector<vector<SB>> &ar){ rep(i,ar.size()){ rep(j,ar[i].size()-1) cout << ar[i][j] << " "; cout << ar[i][ar[i].size()-1] << endl; } } template <typename SC> bool range(SC a, SC b, SC x){return (a <= x && x < b);} bool rrange(P a, P b, P xy){ bool s = range(a.first,b.first,xy.first); bool t = range(a.second,b.second,xy.second); return (s && t); } template <typename SD> void sor(vector<SD> &ar){sort(ar.begin(),ar.end());} template <typename SE> void rev(vector<SE> &ar){reverse(ar.begin(),ar.end());} template <typename SF> bool chmin(SF &a, const SF &b){if(a>b){a = b; return true;} return false;} template <typename SG> bool chmax(SG &a, const SG &b){if(a<b){a = b; return true;} return false;} template <typename SH> void eru(vector<SH> &ar){sor(ar);ar.erase(unique(ar.begin(),ar.end()),ar.end());} template <typename SI> SI last(vector<SI> &ar){return ar[ar.size()-1];} template <typename SJ> SJ cel(SJ a, SJ b){if (a % b == 0) return a/b; return a/b +1;} template <typename SK, typename SL> void pout(pair<SK,SL> p) {cout << p.first << " " << p.second << endl;} void yes(){cout << "Yes" << endl;} void no (){cout << "No" << endl;} void yn (bool t){if(t)yes();else no();} void Yes(){cout << "YES" << endl;} void No (){cout << "NO" << endl;} void YN (bool t){if(t)Yes();else No();} void dout() {cout << setprecision(20);} vector<int> dx = {0,1,0,-1}; vector<int> dy = {1,0,-1,0}; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const string alp = "abcdefghijklmnopqrstuvwxyz"; ll gcds(ll a, ll b){ ll c = a % b; while (c != 0){ a = b; b = c; c = a % b; } return b; } ll cnt(vector<ll> &ar, ll x){ ll le = -1; ll ri = ar.size(); ll mid = (le + ri) / 2; while (ri - le > 1){ if (ar[mid] <= x) le = mid; else ri = mid; mid = (le + ri) / 2; } return le + 1; } ll slv(vector<ll> &ar, ll n, ll k, map<PL,ll> &mp){ if (mp.find(PL(n,k)) != mp.end()) return mp[PL(n,k)]; if (n == 13) return mp[PL(n,k)] = cnt(ar,k); if (k == 1) return mp[PL(n,k)] = 2; if (n > k) return mp[PL(n,k)] = slv(ar,max(13LL,k),k,mp); return mp[PL(n,k)] = slv(ar,n-1,k,mp) + slv(ar,n-1,k/n,mp); } int main(){ int n; cin >> n; ll k; cin >> k; vector<ll> kai(14,1); repp(i,14,2) kai[i] = kai[i-1] * i; if (n <= 13){ vector<ll> ar(1<<n); rep(i,1<<n){ ll h = 1; rep(j,n) if (i >> j & 1) h *= j+1; ar[i] = h; } sor(ar); cout << cnt(ar,k) - 1 << endl; } else { vector<ll> ar(1<<13); rep(i,1<<13){ ll h = 1; rep(j,13) if (i >> j & 1) h *= j+1; ar[i] = h; } sor(ar); map<PL,ll> mp; cout << slv(ar,n,k,mp) - 1 << endl; } }