結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー vwxyzvwxyz
提出日時 2024-04-15 11:36:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 78,340 KB
最終ジャッジ日時 2024-04-15 11:36:36
合計ジャッジ時間 6,967 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 610 ms
78,036 KB
testcase_03 AC 474 ms
75,364 KB
testcase_04 WA -
testcase_05 AC 40 ms
53,728 KB
testcase_06 AC 40 ms
53,596 KB
testcase_07 AC 40 ms
53,132 KB
testcase_08 AC 154 ms
68,724 KB
testcase_09 AC 39 ms
52,528 KB
testcase_10 AC 39 ms
52,536 KB
testcase_11 AC 45 ms
52,372 KB
testcase_12 AC 76 ms
63,960 KB
testcase_13 AC 40 ms
52,532 KB
testcase_14 AC 39 ms
53,684 KB
testcase_15 AC 42 ms
52,760 KB
testcase_16 AC 39 ms
52,748 KB
testcase_17 AC 39 ms
52,684 KB
testcase_18 AC 40 ms
52,528 KB
testcase_19 AC 40 ms
53,412 KB
testcase_20 AC 39 ms
52,620 KB
testcase_21 AC 39 ms
53,068 KB
testcase_22 AC 40 ms
53,696 KB
testcase_23 AC 39 ms
53,792 KB
testcase_24 AC 39 ms
53,320 KB
testcase_25 AC 40 ms
53,064 KB
testcase_26 WA -
testcase_27 AC 41 ms
52,888 KB
testcase_28 AC 39 ms
52,592 KB
testcase_29 AC 40 ms
52,268 KB
testcase_30 WA -
testcase_31 AC 40 ms
52,192 KB
testcase_32 AC 72 ms
63,644 KB
testcase_33 AC 50 ms
61,136 KB
testcase_34 AC 113 ms
65,596 KB
testcase_35 AC 603 ms
78,168 KB
testcase_36 AC 329 ms
72,236 KB
testcase_37 AC 647 ms
78,340 KB
testcase_38 AC 611 ms
78,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
inf=1<<30
dp=[inf]*(N+1)
dp[0]=0
for i in range(1,N+1):
    for j in range(1,int(i**.5)+1):
        dp[i]=min(dp[i],dp[i-j*j]+j)
lst=[[],[]]
i=N
while i:
    for j in range(1,int(i**.5)+1):
        if dp[i]==dp[i-j*j]+j:
            i-=j*j
            lst[j%2].append(j)
ans_lst=[]
lst[0].sort(reverse=True)
lst[1].sort()
for x in lst[1]:
    for i in range(x):
        ans_lst.append(i%2)
p=0
for x in lst[0]:
    for i in range(x):
        ans_lst.append((i+p)%2)
    p^=1
print(*ans_lst,sep="")
0