結果

問題 No.2397 ω冪
ユーザー かつっぱ競プロかつっぱ競プロ
提出日時 2023-07-28 23:33:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,618 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 117,732 KB
最終ジャッジ日時 2024-04-16 07:30:48
合計ジャッジ時間 69,237 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,588 ms
109,772 KB
testcase_01 AC 1,596 ms
110,820 KB
testcase_02 AC 1,591 ms
111,592 KB
testcase_03 AC 1,581 ms
110,696 KB
testcase_04 AC 1,599 ms
111,568 KB
testcase_05 AC 1,594 ms
111,928 KB
testcase_06 AC 1,587 ms
111,592 KB
testcase_07 AC 1,584 ms
111,588 KB
testcase_08 AC 1,597 ms
111,568 KB
testcase_09 AC 1,584 ms
111,580 KB
testcase_10 AC 1,594 ms
111,348 KB
testcase_11 AC 1,593 ms
111,592 KB
testcase_12 AC 1,594 ms
111,592 KB
testcase_13 AC 1,592 ms
111,464 KB
testcase_14 WA -
testcase_15 AC 1,601 ms
111,580 KB
testcase_16 AC 1,598 ms
111,596 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1,611 ms
111,648 KB
testcase_20 AC 1,639 ms
111,824 KB
testcase_21 AC 1,624 ms
111,832 KB
testcase_22 AC 1,605 ms
111,596 KB
testcase_23 AC 1,629 ms
111,604 KB
testcase_24 AC 1,629 ms
111,580 KB
testcase_25 AC 1,612 ms
111,596 KB
testcase_26 AC 1,647 ms
111,464 KB
testcase_27 AC 1,602 ms
111,596 KB
testcase_28 AC 1,605 ms
111,464 KB
testcase_29 AC 1,600 ms
111,596 KB
testcase_30 AC 1,617 ms
111,596 KB
testcase_31 AC 1,612 ms
111,468 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,604 ms
111,696 KB
testcase_35 AC 1,617 ms
111,724 KB
testcase_36 AC 1,619 ms
116,824 KB
testcase_37 AC 1,628 ms
116,592 KB
testcase_38 AC 1,620 ms
116,840 KB
testcase_39 AC 1,625 ms
116,824 KB
testcase_40 AC 1,614 ms
117,732 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 ps in order[::-1]:
        xSum = 0
        ySum = 0
        for p in ps:
            xSum += xCnt[p]
            ySum += yCnt[p]
        if xSum != ySum:            
            return xSum > ySum        
    return False

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

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

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


group = []
for v in order2:
    if len(group) == 0 or toCnt2(group[-1][0]) != toCnt2(v):
        group.append([v])
    else:
        group[-1].append(v)

rank = [0] * 10**5
for i in range(len(group)):
    for v in group[i]:
        rank[v] = 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