結果

問題 No.2397 ω冪
ユーザー かつっぱ競プロかつっぱ競プロ
提出日時 2023-07-28 23:14:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,227 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 118,856 KB
最終ジャッジ日時 2024-04-16 07:11:02
合計ジャッジ時間 49,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,122 ms
110,784 KB
testcase_01 AC 1,124 ms
111,692 KB
testcase_02 AC 1,138 ms
112,716 KB
testcase_03 AC 1,140 ms
111,940 KB
testcase_04 AC 1,124 ms
112,968 KB
testcase_05 AC 1,136 ms
112,708 KB
testcase_06 AC 1,139 ms
112,716 KB
testcase_07 AC 1,128 ms
112,708 KB
testcase_08 AC 1,138 ms
112,700 KB
testcase_09 AC 1,124 ms
112,584 KB
testcase_10 AC 1,122 ms
112,580 KB
testcase_11 AC 1,124 ms
112,712 KB
testcase_12 AC 1,137 ms
112,580 KB
testcase_13 AC 1,148 ms
112,712 KB
testcase_14 WA -
testcase_15 AC 1,130 ms
112,584 KB
testcase_16 AC 1,135 ms
112,332 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1,140 ms
112,588 KB
testcase_20 AC 1,137 ms
112,716 KB
testcase_21 AC 1,134 ms
112,456 KB
testcase_22 AC 1,137 ms
112,832 KB
testcase_23 AC 1,121 ms
112,584 KB
testcase_24 AC 1,131 ms
112,804 KB
testcase_25 AC 1,120 ms
112,840 KB
testcase_26 AC 1,126 ms
112,708 KB
testcase_27 AC 1,120 ms
112,720 KB
testcase_28 AC 1,129 ms
112,460 KB
testcase_29 AC 1,121 ms
112,968 KB
testcase_30 AC 1,125 ms
112,448 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,125 ms
112,448 KB
testcase_35 AC 1,127 ms
112,844 KB
testcase_36 AC 1,186 ms
114,384 KB
testcase_37 AC 1,187 ms
114,496 KB
testcase_38 WA -
testcase_39 AC 1,141 ms
114,780 KB
testcase_40 AC 1,137 ms
118,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

order = [0, 1]

def toCnt(x):
    if x == 0:return defaultdict(int)
    k = 0
    while x % 2 == 0:
        x //= 2
        k += 1
    tmp = toCnt(x // 2)
    tmp[k] += 1
    return tmp
   
# x > y
def gt(x, y):
    xCnt = toCnt(x)
    yCnt = toCnt(y)

    for p in order[::-1]:
        if xCnt[p] > yCnt[p]:
            return True
        if xCnt[p] < xCnt[p]:
            return False
    return False
        

for i in range(2, 20):
    k = 0
    while k < len(order) and gt(i, order[k]):
        k += 1
    order.insert(k, i)


def toCnt2(x):
    xCnt = toCnt(x)
    cnt = [0] * 20
    for i in range(20):
        cnt[order.index(i)] = xCnt[i]
    return cnt[::-1]

order2 = sorted(range(10**5), key=toCnt2)

rank = [0] * (10**5)
for i in range(10**5):
    rank[order2[i]] = i



def cnt3(N):
    nCnt = [0] * (10 ** 5)
    if(N == '0'):
        return nCnt
    nOne = []
    for i in range(len(N)):
        if(N[i] == '1'):
            nOne.append(i)
    nOne.append(len(N))

    for i in range(len(nOne) - 1):
        nCnt[rank[nOne[i+1] - nOne[i] - 1]] += 1
    return nCnt[::-1]

nCnt = cnt3(input())
mCnt = cnt3(input())

if nCnt < mCnt:
    print("Yes")
else:
    print("No")


0