結果

問題 No.873 バイナリ、ヤバいなり!w
ユーザー mkawa2mkawa2
提出日時 2021-03-02 13:01:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,454 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 87,536 KB
最終ジャッジ日時 2024-04-14 04:34:31
合計ジャッジ時間 19,106 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 WA -
testcase_05 AC 40 ms
52,944 KB
testcase_06 AC 40 ms
52,752 KB
testcase_07 AC 38 ms
53,080 KB
testcase_08 WA -
testcase_09 AC 39 ms
52,748 KB
testcase_10 AC 41 ms
52,700 KB
testcase_11 AC 40 ms
53,152 KB
testcase_12 WA -
testcase_13 AC 40 ms
52,956 KB
testcase_14 AC 40 ms
52,732 KB
testcase_15 AC 41 ms
53,144 KB
testcase_16 AC 39 ms
53,208 KB
testcase_17 AC 40 ms
53,076 KB
testcase_18 AC 38 ms
53,672 KB
testcase_19 WA -
testcase_20 AC 38 ms
53,260 KB
testcase_21 AC 39 ms
53,008 KB
testcase_22 AC 39 ms
52,824 KB
testcase_23 AC 39 ms
53,196 KB
testcase_24 AC 38 ms
53,312 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 TLE -
testcase_36 WA -
testcase_37 TLE -
testcase_38 TLE -
権限があれば一括ダウンロードができます

ソースコード

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]+1
        aa[ni] = a

n = II()
dp = [inf]*(n+1)
aa = [-1]*(n+1)
dp[0] = 0
for i in range(n):
    pre = dp[i]
    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="")
0