結果

問題 No.2397 ω冪
ユーザー googol_S0googol_S0
提出日時 2022-11-18 00:52:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,385 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 85,820 KB
最終ジャッジ日時 2023-10-19 15:04:52
合計ジャッジ時間 4,308 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,308 KB
testcase_01 AC 40 ms
53,308 KB
testcase_02 AC 41 ms
53,308 KB
testcase_03 AC 40 ms
53,308 KB
testcase_04 AC 39 ms
53,308 KB
testcase_05 AC 40 ms
53,308 KB
testcase_06 AC 39 ms
53,308 KB
testcase_07 AC 40 ms
53,308 KB
testcase_08 AC 40 ms
53,308 KB
testcase_09 AC 40 ms
53,308 KB
testcase_10 AC 39 ms
53,308 KB
testcase_11 AC 39 ms
53,308 KB
testcase_12 AC 39 ms
53,308 KB
testcase_13 AC 39 ms
53,308 KB
testcase_14 AC 40 ms
53,308 KB
testcase_15 AC 39 ms
53,308 KB
testcase_16 AC 43 ms
53,308 KB
testcase_17 AC 39 ms
53,308 KB
testcase_18 AC 40 ms
53,308 KB
testcase_19 AC 40 ms
53,308 KB
testcase_20 AC 40 ms
53,308 KB
testcase_21 AC 39 ms
53,308 KB
testcase_22 AC 40 ms
53,308 KB
testcase_23 AC 40 ms
53,308 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 39 ms
53,308 KB
testcase_27 WA -
testcase_28 AC 39 ms
53,308 KB
testcase_29 WA -
testcase_30 AC 39 ms
53,308 KB
testcase_31 AC 39 ms
53,308 KB
testcase_32 AC 55 ms
64,180 KB
testcase_33 AC 55 ms
64,180 KB
testcase_34 AC 40 ms
53,308 KB
testcase_35 AC 46 ms
59,412 KB
testcase_36 WA -
testcase_37 AC 255 ms
85,708 KB
testcase_38 WA -
testcase_39 AC 223 ms
85,728 KB
testcase_40 AC 67 ms
79,304 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'))

S='0,1,w,2,w^w,w+1,w,3,w^2,w^(w)+1,w2,w+2,w^w,w+1,w,4,w^w^w'
S=S.split(',')
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):
  A=[]
  b=0
  while N:
    if N&1:
      v=X[b]
      while len(A)>0 and A[-1][0]<v:
        del A[-1]
      if len(A)>0 and A[-1][0]==v:
        A[-1]=(A[-1][0],A[-1][1]+1)
      else:
        A.append((v,1))
      b=0
    else:
      b+=1
    N>>=1
  return tuple(A)

def ord_then(X,Y):
  for i in range(min(len(X),len(Y))):
    if X[i]>Y[i]:
      return -1
    if X[i]<Y[i]:
      return 1
  if len(X)>len(Y):
    return -1
  if len(X)<len(Y):
    return 1
  return  0

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 ord_then(A[-1],v)==1:
      del A[-1]
    else:
      break
  A.append(v)
for i in range(len(Q)):
  v=Q[i]
  while len(B)>0:
    if ord_then(B[-1],v)==1:
      del B[-1]
    else:
      break
  B.append(v)
if A<B:
  print('Yes')
else:
  print('No')
0