結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー milanis48663220milanis48663220
提出日時 2020-06-11 22:46:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 86,012 KB
実行使用メモリ 4,844 KB
最終ジャッジ日時 2023-09-06 08:45:29
合計ジャッジ時間 3,706 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int N;
int d[300001];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 1; i <= N; i++) d[i] = 1e7;
    for(int i = 0; i < N; i++){
        for(int j = 1; i+j*j <= N; j++){
            d[i+j*j] = min(d[i]+1, d[i+j*j]);
        }
    }
    int cur = N;
    vector<int> v, u;
    for(int i = 1; i*i <= N; i +=2 ) v.push_back(i);
    for(int i = 2; i*i <= N; i += 2) u.push_back(i);
    for (auto itr = rbegin(u); itr != rend(u); itr++) v.push_back(*itr);
    int tmp = 0;
    for(int i : v){
        while(true){
            if(cur == 0) break;
            if(cur-i*i < 0) break;
            if(d[cur-i*i]+1 != d[cur]) break;
            cur -= i*i;
            for(int j = 0; j < i; j++) cout << (char)('0'+(tmp^(j%2)));
            if(i%2 == 0) tmp ^= 1;
        }
    }
    cout << endl;
}
0