結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-18 22:34:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 1,573 ms |
| コンパイル使用メモリ | 166,424 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 13:25:23 |
| 合計ジャッジ時間 | 2,270 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;
int main(){
int n; cin >> n;
if(n == 0){
cout << 1 << endl;
return 0;
}
int a = 0, x = n;
while(x % 2 == 0){
x /= 2;
a++;
}
if(x == 1){
cout << a + 2 << endl;
for(int i = 0; i < a; i++) cout << 0 << " ";
cout << 1 << " " << 1 << endl;
return 0;
}
for(int i = 2; i * i <= n; i++){
if(n % i or n % (i + 1)) continue;
int B = i + 1;
int pos = n / ((i * (i + 1)) / 2);
int A = 0;
while(pos % 2 == 0){
pos /= 2;
A++;
}
if(pos != 1) continue;
cout << A + B << endl;
for(int i = 0; i < A; i++) cout << 0 << " ";
for(int i = 0; i < B; i++) cout << 1 << " ";
cout << endl;
break;
}
return 0;
}