結果
| 問題 |
No.1871 divisXor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-11 23:31:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 478 bytes |
| コンパイル時間 | 1,869 ms |
| コンパイル使用メモリ | 195,044 KB |
| 最終ジャッジ日時 | 2025-01-28 09:08:42 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
// f(2^n) ^ f(2^{n-1}) = 2^n
ll N; cin >> N;
if(N == 0){ cout << -1 << endl; return 0; }
vector<ll> ans;
ll target = N ^ (N >> 1);
rep(i,40) if(target & (1LL << i)) ans.push_back(1LL << i);
cout << ans.size() << endl;
for(ll a : ans) cout << a << " "; cout << endl;
}