結果
問題 |
No.1871 divisXor
|
ユーザー |
![]() |
提出日時 | 2022-03-12 03:26:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 865 bytes |
コンパイル時間 | 3,205 ms |
コンパイル使用メモリ | 203,352 KB |
最終ジャッジ日時 | 2025-01-28 09:15:33 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 2 WA * 27 |
ソースコード
#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; vector<ll> divisor(ll x){ set<ll> s; for(ll i=1;i*i<=x;i++){ if(x%i==0){ s.insert(i); s.insert(x/i); } } vector<ll> res; for(auto y:s) res.push_back(y); return res; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n; cin>>n; if(n==0){ cout<<-1<<endl; return 0; } vector<pair<ll,ll>> A; ll tmp=1; ll ttmp=1; rep(i,32){ A.push_back({tmp,ttmp}); tmp=tmp*2+1; ttmp*=2; } vector<ll> ANS; for(int i=32;i>=0;i--){ if(n&(1<<i)){ ANS.push_back(A[i].second); n^=A[i].first; } } int a=ANS.size(); cout<<a<<endl; rep(i,a){ if(i) cout<<" "; cout<<ANS[i]; } cout<<endl; return 0; }