結果

問題 No.2397 ω冪
ユーザー googol_S0googol_S0
提出日時 2022-11-17 18:29:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,269 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 81,580 KB
実行使用メモリ 77,248 KB
最終ジャッジ日時 2023-10-19 09:42:07
合計ジャッジ時間 4,614 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,336 KB
testcase_01 AC 40 ms
53,336 KB
testcase_02 AC 41 ms
53,336 KB
testcase_03 AC 40 ms
53,336 KB
testcase_04 AC 43 ms
53,336 KB
testcase_05 AC 43 ms
53,336 KB
testcase_06 AC 43 ms
53,336 KB
testcase_07 AC 40 ms
53,336 KB
testcase_08 AC 40 ms
53,336 KB
testcase_09 AC 41 ms
53,336 KB
testcase_10 AC 39 ms
53,336 KB
testcase_11 AC 40 ms
53,336 KB
testcase_12 AC 39 ms
53,336 KB
testcase_13 AC 39 ms
53,336 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 40 ms
53,336 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 39 ms
53,336 KB
testcase_21 AC 39 ms
53,336 KB
testcase_22 AC 39 ms
53,336 KB
testcase_23 AC 39 ms
53,336 KB
testcase_24 WA -
testcase_25 AC 40 ms
53,336 KB
testcase_26 AC 39 ms
53,336 KB
testcase_27 WA -
testcase_28 AC 40 ms
53,336 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 39 ms
53,336 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 40 ms
53,336 KB
testcase_35 AC 48 ms
61,736 KB
testcase_36 WA -
testcase_37 AC 73 ms
77,248 KB
testcase_38 WA -
testcase_39 AC 73 ms
76,868 KB
testcase_40 AC 46 ms
61,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=input()
M=input()
assert(1<=len(N))
assert(len(N)<=100000)
assert(1<=len(M))
assert(len(M)<=100000)
assert((N=='0')or(N[0]!='0'))
assert((N=='0')or(N[0]!='0'))
assert((M=='0')or(M[0]!='0'))
P=0
b=0
A=[]
for i in range(len(N)-1,-1,-1):
  if N[i]=='0':
    b+=1
  else:
    if b==0:
      P-=1
      continue
    A.append(b)
    b=0
b=0
B=[]
for i in range(len(M)-1,-1,-1):
  if M[i]=='0':
    b+=1
  else:
    if b==0:
      P+=1
      continue
    B.append(b)
    b=0

def dfs(A,B):
  if len(A)==0:
    if len(B)==0:
      return 0
    else:
      return 1
  elif len(B)==0:
    return -1
  P=0
  AN=[]
  BN=[]
  for i in range(len(A)):
    x=A[i]
    b=0
    while x>0:
      if x&1:
        if b==0:
          P-=1
        else:
          AN.append(b)
        b=0
      else:
        b+=1
      x>>=1
  for i in range(len(B)):
    x=B[i]
    b=0
    while x>0:
      if x&1:
        if b==0:
          P+=1
        else:
          BN.append(b)
        b=0
      else:
        b+=1
      x>>=1
  win=dfs(AN,BN)
  if win==0:
    if P==0:
      return 0
    elif P>0:
      return 1
    else:
      return -1
  else:
    return win

win=dfs(A,B)
if win==0:
  if P>0:
    print('Yes')
  else:
    print('No')
else:
  if win==1:
    print('Yes')
  else:
    print('No')
0