結果
| 問題 |
No.1871 divisXor
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2022-03-12 03:31:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 867 bytes |
| コンパイル時間 | 2,175 ms |
| コンパイル使用メモリ | 204,056 KB |
| 最終ジャッジ日時 | 2025-01-28 09:15:44 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
#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,43){
A.push_back({tmp,ttmp});
tmp=tmp*2+1;
ttmp*=2;
}
vector<ll> ANS;
for(int i=42;i>=0;i--){
if(n&(1LL<<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;
}
umezo