結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー mkawa2mkawa2
提出日時 2021-03-02 14:08:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,497 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 82,612 KB
実行使用メモリ 90,840 KB
最終ジャッジ日時 2024-04-14 04:37:35
合計ジャッジ時間 8,302 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 37 ms
53,776 KB
testcase_06 AC 36 ms
52,748 KB
testcase_07 AC 38 ms
53,120 KB
testcase_08 WA -
testcase_09 AC 37 ms
53,972 KB
testcase_10 AC 37 ms
52,616 KB
testcase_11 AC 36 ms
53,936 KB
testcase_12 WA -
testcase_13 AC 37 ms
53,076 KB
testcase_14 AC 37 ms
53,816 KB
testcase_15 AC 37 ms
54,084 KB
testcase_16 AC 37 ms
53,232 KB
testcase_17 AC 36 ms
53,208 KB
testcase_18 AC 36 ms
52,676 KB
testcase_19 AC 37 ms
53,012 KB
testcase_20 AC 36 ms
53,624 KB
testcase_21 AC 36 ms
53,040 KB
testcase_22 AC 37 ms
53,316 KB
testcase_23 AC 36 ms
53,384 KB
testcase_24 AC 36 ms
53,116 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def FI(): return float(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def MF(): return map(float, sys.stdin.buffer.readline().split())
def MI1(): return map(int1, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
inf = 10**16
# md = 998244353
md = 10**9+7

def chmin(i, a):
    ni=i+a**2
    if dp[i]+1 < dp[ni] or (dp[i]+1 == dp[ni] and aa[ni]%2==0 and a%2==1):
        dp[ni] = dp[i]+a
        aa[ni] = a

n = II()
dp = [inf]*(n+1)
aa = [-1]*(n+1)
dp[0] = 0
for i in range(n):
    pre = dp[i]
    if pre==inf:continue
    for a in range(1, 1000):
        if i+a**2 > n: break
        chmin(i, a)
# print(dp[-1])
# print(aa)

now = n
ans = [0]
dd=[]
while now > 0:
    a = aa[now]
    dd.append(a)
    now -= a**2

dd.sort(key=lambda x:(1-x%2,x))

for d in dd:
    ans.append(ans[-1])
    for _ in range(d-1):
        ans.append(1-ans[-1])

print(*ans[1:], sep="")
# print(len(ans))
0