結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー ptotqptotq
提出日時 2019-08-30 23:18:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,287 bytes
コンパイル時間 1,672 ms
コンパイル使用メモリ 170,792 KB
実行使用メモリ 5,880 KB
最終ジャッジ日時 2023-09-06 07:06:08
合計ジャッジ時間 3,810 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 181 ms
4,812 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, start, end) for (int i=start, i##Len=(end); i < i##Len; ++i)
using ll = int64_t;
using namespace std;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    static int dp[300010] = {};
    static int from[300010] = {};
    dp[N] = 1;

    while (dp[0] == 0) {
        REP(i, 0, N+1) if (dp[i] > 0) {
            ll base = 1;
            while (base*base <= i) {
                dp[i-base*base] = dp[i]+1;
                from[i-base*base] = base;
                ++base;
            }
        }
    }

    vector<int> result;
    int i = 0;
    while (i < N) {
        result.push_back(from[i]);
        i += from[i]*from[i];
    }

    string answer = "";
    sort(result.begin(), result.end());
    for (auto x: result) {
        if (x % 2 == 0) continue;
        answer += "0";
        REP(i, 0, (x-1)/2) answer += "10";
    }
    int first_zero = 1;
    for (int i=result.size()-1; i >= 0; --i) {
        if (result[i] % 2) continue;
        if (first_zero) {
            REP(j, 0, result[i]/2) answer += "01";
        } else {
            REP(j, 0, result[i]/2) answer += "10";
        }
        first_zero ^= 1;
    }

    cout << answer << endl;
    return 0;
}
0