結果
| 問題 | 
                            No.688 E869120 and Constructing Array 2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-05-18 22:52:00 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,314 bytes | 
| コンパイル時間 | 685 ms | 
| コンパイル使用メモリ | 95,848 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-07 13:32:34 | 
| 合計ジャッジ時間 | 2,019 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 3 WA * 7 | 
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;
const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second
int rr(ll p) {
	int cnt = 0;
	if (p == 1)return 1;
	while (p > 1) {
		if (p % 2 == 1)return 0;
		p /= 2;
		cnt++;
	}
	return cnt;
}
int main() {
	ll k;
	cin >> k;
	if (k == 1) {
		cout << 2 << endl;
		cout << 1 << ' ' << 1 << endl;
		return 0;
	}
	for (int i = 2;i <= 30;i++) {
		if (k % (i*(i - 1) / 2) == 0 && rr(k / ((i*(i - 1))/2))&& rr(k /( (i*(i - 1))/2)) <= 30 - i) {
			cout << i + rr(k / ((i*(i - 1) / 2)))<<endl;
			for (int j = 0;j < i;j++)cout << 1 << ' ';
			for (int j = 0;j < rr(k /( (i*(i - 1)/2)))-1;j++)cout << 0 << ' ';
			cout << endl;
			return 0;
		}
	}
	return 0;
}