結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 65 ms
71,292 KB
testcase_06 AC 65 ms
71,872 KB
testcase_07 AC 65 ms
71,908 KB
testcase_08 WA -
testcase_09 AC 65 ms
71,704 KB
testcase_10 AC 63 ms
71,800 KB
testcase_11 AC 67 ms
71,724 KB
testcase_12 AC 70 ms
75,560 KB
testcase_13 AC 67 ms
71,552 KB
testcase_14 AC 69 ms
71,960 KB
testcase_15 AC 66 ms
71,828 KB
testcase_16 AC 65 ms
71,880 KB
testcase_17 AC 66 ms
71,792 KB
testcase_18 AC 67 ms
71,680 KB
testcase_19 AC 67 ms
71,680 KB
testcase_20 AC 73 ms
71,668 KB
testcase_21 AC 66 ms
71,808 KB
testcase_22 AC 64 ms
71,676 KB
testcase_23 AC 65 ms
71,524 KB
testcase_24 AC 67 ms
71,712 KB
testcase_25 AC 64 ms
71,864 KB
testcase_26 AC 65 ms
71,792 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 65 ms
71,832 KB
testcase_34 AC 74 ms
76,832 KB
testcase_35 WA -
testcase_36 AC 76 ms
76,660 KB
testcase_37 WA -
testcase_38 AC 81 ms
76,860 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
    elif sum(q) == sum(l):
        if sum(i % 2 for i in q) > sum(i % 2 for i in 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