結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー nadarenadare
提出日時 2019-08-30 23:14:52
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 769 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 79,684 KB
最終ジャッジ日時 2023-09-06 07:05:57
合計ジャッジ時間 16,387 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 438 ms
78,160 KB
testcase_02 AC 1,599 ms
79,144 KB
testcase_03 AC 1,290 ms
78,824 KB
testcase_04 AC 95 ms
71,612 KB
testcase_05 AC 96 ms
71,804 KB
testcase_06 AC 95 ms
71,588 KB
testcase_07 AC 95 ms
71,564 KB
testcase_08 AC 395 ms
77,984 KB
testcase_09 AC 94 ms
71,400 KB
testcase_10 AC 94 ms
71,728 KB
testcase_11 AC 94 ms
71,748 KB
testcase_12 AC 176 ms
77,540 KB
testcase_13 AC 93 ms
71,524 KB
testcase_14 AC 94 ms
71,924 KB
testcase_15 AC 92 ms
71,656 KB
testcase_16 AC 93 ms
71,588 KB
testcase_17 AC 93 ms
71,620 KB
testcase_18 AC 93 ms
71,676 KB
testcase_19 AC 95 ms
71,732 KB
testcase_20 AC 95 ms
71,844 KB
testcase_21 AC 94 ms
71,688 KB
testcase_22 AC 93 ms
71,596 KB
testcase_23 AC 92 ms
71,900 KB
testcase_24 AC 93 ms
71,752 KB
testcase_25 AC 94 ms
71,792 KB
testcase_26 AC 93 ms
71,560 KB
testcase_27 AC 93 ms
71,568 KB
testcase_28 AC 95 ms
71,708 KB
testcase_29 AC 94 ms
71,452 KB
testcase_30 AC 94 ms
71,576 KB
testcase_31 AC 95 ms
71,684 KB
testcase_32 AC 140 ms
77,416 KB
testcase_33 AC 113 ms
77,136 KB
testcase_34 AC 282 ms
77,880 KB
testcase_35 AC 1,691 ms
79,172 KB
testcase_36 AC 878 ms
78,724 KB
testcase_37 AC 1,737 ms
79,352 KB
testcase_38 AC 1,677 ms
79,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def inpl(): return list(map(int, input().split()))

N = int(input())

DP = [10**9]*(N+1)
DP[0] = 0
F = [i**2 for i in range(1, 550)]
E = []
O = []

for i in range(N):
    for j, f in enumerate(F, start=1):
        if i + f > N:
            break
        DP[i+f] = min(DP[i+f], DP[i]+j)

x = N
while x:
    for j, f in enumerate(F, start=1):
        if DP[x] == DP[x-f] + j:
            if j%2:
                O.append(j)
            else:
                E.append(j)
            x -= f
            break


O = sorted(O)
E = deque(sorted(E))

ans = []

for o in O:
    ans.append("01"*(o//2) + "0")

while E:
    e = E.pop()
    ans.append("01"*(e//2))
    if E:
        e = E.popleft()
        ans.append("10"*(e//2))

print("".join(ans))
0