結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-22 23:48:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,050 bytes |
| コンパイル時間 | 1,578 ms |
| コンパイル使用メモリ | 169,648 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 09:16:17 |
| 合計ジャッジ時間 | 2,607 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define llong long long
int main() {
int k;
cin >> k;
int korg = k;
if(k==0) {
cout << 1 << endl;
cout << 0 << endl;
return 0;
}
int twices = 0;
while(k % 2 == 0) {
k /= 2;
twices++;
}
vector<int> cands;
for(int i=1; i<16; i++) {
int val = i * (i+1) / 2;
if(val % k == 0) {
cands.push_back(i);
}
}
for(int lowval: cands) {
int val = lowval * (lowval+1) / 2;
int rest = korg / val;
int zeroval = 0;
while(rest % 2 == 0) {
rest /= 2;
zeroval++;
}
if(lowval + 1 + zeroval <= 30) {
cout << lowval + 1 + zeroval << "\n";
rep(i, zeroval) cout << "0 ";
rep(i, lowval+1) {
cout << "1";
if(i < lowval) cout << " ";
}
cout << "\n";
return 0;
}
}
}