結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,120 ms
112,188 KB
testcase_01 AC 1,118 ms
112,196 KB
testcase_02 AC 1,129 ms
112,204 KB
testcase_03 AC 1,126 ms
112,196 KB
testcase_04 AC 1,128 ms
112,192 KB
testcase_05 AC 1,130 ms
112,580 KB
testcase_06 AC 1,123 ms
112,464 KB
testcase_07 AC 1,119 ms
112,580 KB
testcase_08 AC 1,130 ms
112,448 KB
testcase_09 AC 1,123 ms
112,588 KB
testcase_10 AC 1,133 ms
112,580 KB
testcase_11 AC 1,133 ms
112,456 KB
testcase_12 AC 1,124 ms
112,444 KB
testcase_13 AC 1,225 ms
112,448 KB
testcase_14 WA -
testcase_15 AC 1,158 ms
112,444 KB
testcase_16 AC 1,139 ms
112,572 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1,128 ms
112,712 KB
testcase_20 AC 1,133 ms
112,708 KB
testcase_21 WA -
testcase_22 AC 1,127 ms
112,332 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1,130 ms
112,700 KB
testcase_26 WA -
testcase_27 AC 1,134 ms
112,328 KB
testcase_28 AC 1,122 ms
112,448 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1,123 ms
112,720 KB
testcase_36 WA -
testcase_37 AC 1,146 ms
114,380 KB
testcase_38 AC 1,140 ms
114,752 KB
testcase_39 WA -
testcase_40 RE -
権限があれば一括ダウンロードができます

ソースコード

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):
    nOne = []
    for i in range(len(N)):
        if(N[i] == '1'):
            nOne.append(i)
    nOne.append(len(N))
    nCnt = [0] * (10 ** 5)
    for i in range(len(nOne) - 1):
        nCnt[rank[nOne[i+1] - nOne[i]]] += 1
    return nCnt[::-1]

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

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


0