結果

問題 No.2397 ω冪
ユーザー googol_S0googol_S0
提出日時 2022-11-18 03:55:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 1,139 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 81,592 KB
実行使用メモリ 86,112 KB
最終ジャッジ日時 2023-10-19 17:28:54
合計ジャッジ時間 3,907 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,504 KB
testcase_01 AC 39 ms
53,504 KB
testcase_02 AC 39 ms
53,504 KB
testcase_03 AC 40 ms
53,504 KB
testcase_04 AC 39 ms
53,504 KB
testcase_05 AC 38 ms
53,504 KB
testcase_06 AC 39 ms
53,504 KB
testcase_07 AC 39 ms
53,504 KB
testcase_08 AC 39 ms
53,504 KB
testcase_09 AC 39 ms
53,504 KB
testcase_10 AC 38 ms
53,504 KB
testcase_11 AC 40 ms
53,504 KB
testcase_12 AC 39 ms
53,504 KB
testcase_13 AC 39 ms
53,504 KB
testcase_14 AC 39 ms
53,504 KB
testcase_15 AC 39 ms
53,504 KB
testcase_16 AC 39 ms
53,504 KB
testcase_17 AC 39 ms
53,504 KB
testcase_18 AC 39 ms
53,504 KB
testcase_19 AC 38 ms
53,504 KB
testcase_20 AC 39 ms
53,504 KB
testcase_21 AC 39 ms
53,504 KB
testcase_22 AC 39 ms
53,504 KB
testcase_23 AC 39 ms
53,504 KB
testcase_24 AC 39 ms
53,504 KB
testcase_25 AC 38 ms
53,504 KB
testcase_26 AC 39 ms
53,504 KB
testcase_27 AC 39 ms
53,504 KB
testcase_28 AC 38 ms
53,504 KB
testcase_29 AC 38 ms
53,504 KB
testcase_30 AC 39 ms
53,504 KB
testcase_31 AC 39 ms
53,504 KB
testcase_32 AC 51 ms
62,296 KB
testcase_33 AC 50 ms
62,312 KB
testcase_34 AC 39 ms
53,512 KB
testcase_35 AC 45 ms
59,624 KB
testcase_36 AC 195 ms
85,552 KB
testcase_37 AC 200 ms
85,756 KB
testcase_38 AC 192 ms
85,528 KB
testcase_39 AC 190 ms
86,112 KB
testcase_40 AC 66 ms
79,504 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'))

X=[0,1,5,2,10,6,5,3,9,11,8,7,10,6,5,4,12]
X=[X[i]+1 for i in range(len(X))]
def f(N):
  P=[]
  b=0
  while N:
    if N&1:
      v=X[b]
      P.append(v)
      b=0
    else:
      b+=1
    N>>=1
  P=P[::-1]
  A=[]
  for i in range(len(P)):
    while len(A)>0 and A[-1][0]<P[i]:
      del A[-1]
    if len(A)>0 and A[-1][0]==P[i]:
      A[-1]=(A[-1][0],A[-1][1]+1)
    else:
      A.append((P[i],1))
  return tuple(A)

P=[]
Q=[]
b=0
for i in range(len(N)-1,-1,-1):
  if N[i]=='0':
    b+=1
  else:
    v=f(b)
    P.append(v)
    b=0
P=P[::-1]
b=0
for i in range(len(M)-1,-1,-1):
  if M[i]=='0':
    b+=1
  else:
    v=f(b)
    Q.append(v)
    b=0
Q=Q[::-1]
A=[]
B=[]
for i in range(len(P)):
  v=P[i]
  while len(A)>0:
    if A[-1]<v:
      del A[-1]
    else:
      break
  A.append(v)
for i in range(len(Q)):
  v=Q[i]
  while len(B)>0:
    if B[-1]<v:
      del B[-1]
    else:
      break
  B.append(v)
if A<B:
  print('Yes')
else:
  print('No')
0