結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 66 ms
71,312 KB
testcase_06 AC 65 ms
71,844 KB
testcase_07 AC 66 ms
71,872 KB
testcase_08 WA -
testcase_09 AC 66 ms
71,952 KB
testcase_10 AC 64 ms
71,548 KB
testcase_11 AC 65 ms
71,528 KB
testcase_12 AC 71 ms
75,356 KB
testcase_13 AC 68 ms
71,528 KB
testcase_14 AC 67 ms
71,708 KB
testcase_15 AC 68 ms
71,884 KB
testcase_16 AC 67 ms
71,520 KB
testcase_17 AC 67 ms
71,684 KB
testcase_18 AC 68 ms
71,864 KB
testcase_19 AC 70 ms
71,836 KB
testcase_20 AC 68 ms
71,872 KB
testcase_21 AC 69 ms
71,672 KB
testcase_22 AC 68 ms
71,796 KB
testcase_23 AC 69 ms
71,444 KB
testcase_24 AC 68 ms
71,520 KB
testcase_25 AC 67 ms
71,516 KB
testcase_26 AC 66 ms
71,956 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 64 ms
71,368 KB
testcase_34 AC 70 ms
76,852 KB
testcase_35 WA -
testcase_36 AC 74 ms
76,652 KB
testcase_37 WA -
testcase_38 AC 77 ms
76,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

l = [10 ** 100]
n = int(input())
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 sum(q) < sum(l):
        l = q
odd, even = [], []
for i in l:
    if i % 2 == 1:
        odd.append(i)
    else:
        even.append(i)
odd = sorted(odd)
even = sorted(even)

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

res = ''
for i in odd:
    res += f(0, i)
fir = 0
for i in even:
    res += f(fir, i)
    fir ^= 1
print(res)
0