結果

問題 No.2397 ω冪
ユーザー 👑 testestest
提出日時 2022-11-18 20:43:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2024-09-20 01:24:11
合計ジャッジ時間 4,967 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(A,B,f):
  # return A<B
  AA=f(A)
  BB=f(B)
  for aa,bb in zip(AA,BB):
    if aa!=bb:
      #return check(aa,bb,f)
      return int(aa)<int(bb)
  return len(AA)<len(BB)

def f(S):
  temp=[]
  cnt=0
  for c in S[::-1]:
    if c=='0':
      cnt+=1
    else:
      temp.append(bin(cnt)[2:])
      cnt=0
  ans=[]
  for s in temp[::-1]:
    while len(ans) and check(ans[-1],s,f):
      ans.pop()
    ans.append(s)
  return ans

N=input()
M=input()
print("Yes" if check(N,M,f) else "No")
0