結果

問題 No.688 E869120 and Constructing Array 2
コンテスト
ユーザー yosupot
提出日時 2018-05-18 23:28:18
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,156 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 675 ms
コンパイル使用メモリ 131,144 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-29 04:10:50
合計ジャッジ時間 1,281 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

int main() {
    ll k;
    cin >> k;
    for (int n = 2; n <= 30; n++) {
        for (int a = 0; a <= n-2; a++) {
            int b = n-a;
            ll z = b*(b-1) / 2;
            for (int i = 0; i < a; i++) {
                z *= 2;
            }
            if (k == z) {
                cout << n << endl;
                for (int i = 0; i < a; i++) {
                    cout << 0 << " ";
                }
                for (int i = a; i < n; i++) {
                    cout << 1 << " ";
                }
                cout << endl;
            }
        }
    }
    return 0;
}
0