結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー もりをもりを
提出日時 2019-08-30 21:52:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 921 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 77,832 KB
最終ジャッジ日時 2023-09-06 06:46:45
合計ジャッジ時間 4,386 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 65 ms
71,564 KB
testcase_06 AC 63 ms
71,832 KB
testcase_07 AC 66 ms
71,704 KB
testcase_08 WA -
testcase_09 AC 64 ms
71,800 KB
testcase_10 AC 65 ms
71,784 KB
testcase_11 AC 68 ms
71,528 KB
testcase_12 AC 69 ms
76,860 KB
testcase_13 AC 60 ms
71,516 KB
testcase_14 AC 64 ms
71,872 KB
testcase_15 AC 63 ms
71,564 KB
testcase_16 AC 65 ms
71,524 KB
testcase_17 AC 66 ms
71,796 KB
testcase_18 AC 66 ms
71,788 KB
testcase_19 AC 66 ms
71,904 KB
testcase_20 AC 65 ms
71,680 KB
testcase_21 AC 66 ms
71,784 KB
testcase_22 AC 69 ms
71,700 KB
testcase_23 AC 65 ms
71,872 KB
testcase_24 AC 66 ms
71,484 KB
testcase_25 AC 64 ms
71,792 KB
testcase_26 AC 64 ms
71,812 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 66 ms
71,796 KB
testcase_34 AC 75 ms
76,864 KB
testcase_35 WA -
testcase_36 AC 81 ms
76,928 KB
testcase_37 WA -
testcase_38 AC 88 ms
77,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(fir, sz):
    ret = ''
    if fir == 0:
        ret += '01' * (sz // 2)
        if sz % 2 == 1:
            ret += '0'
    else:
        ret += '10' * (sz // 2)
        if sz % 2 == 1:
            ret += '1'
    return ret

def g(l):
    odd, even = [], []
    for i in l:
        if i % 2 == 1:
            odd.append(i)
        else:
            even.append(i)
    odd = sorted(odd)
    even = sorted(even)
    res = ''
    for i in odd:
        res += f(0, i)
    fir = 0
    for i in even:
        res += f(fir, i)
        fir ^= 1
    return res

n = int(input())
res = '2'
for i in range(int(n ** 0.5), 0, -1):
    q = [i]
    m = n - i ** 2
    while m:
        p = int(m ** 0.5)
        q.append(p)
        m -= p ** 2
    if res == '2':
        res = g(q)
    else:
        s = g(q)
        if len(s) < len(res):
            res = s
        elif len(s) == len(res):
            res = min(res, s)
print(res)
0