結果
問題 |
No.2081 Make a Test Case of GCD Subset
|
ユーザー |
![]() |
提出日時 | 2022-09-25 22:50:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 854 bytes |
コンパイル時間 | 2,298 ms |
コンパイル使用メモリ | 204,240 KB |
最終ジャッジ日時 | 2025-02-07 15:38:52 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 WA * 3 RE * 21 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int C[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47}; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll m; cin>>m; priority_queue<pair<ll,ll>> que; ll t=2; ll now=1; while(t<1e5){ que.push({t-1,now}); t*=2; now++; } queue<ll> que2; while(m>0){ while(que.top().first>m) que.pop(); que2.push(que.top().second); m-=que.top().first; } vector<ll> ANS; int nx=0; while(que2.size()){ ll a=que2.front(); que2.pop(); ll c=C[nx]; rep(i,a){ ANS.push_back(c); c*=C[nx]; } nx++; } int y=ANS.size(); cout<<y<<endl; rep(i,y){ if(i) cout<<" "; cout<<ANS[i]; } cout<<endl; return 0; }