結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,561 ms
109,344 KB
testcase_01 AC 1,554 ms
109,732 KB
testcase_02 AC 1,567 ms
110,856 KB
testcase_03 AC 1,558 ms
109,988 KB
testcase_04 AC 1,563 ms
110,944 KB
testcase_05 AC 1,567 ms
110,880 KB
testcase_06 AC 1,554 ms
110,756 KB
testcase_07 AC 1,556 ms
110,880 KB
testcase_08 AC 1,560 ms
111,088 KB
testcase_09 AC 1,563 ms
110,976 KB
testcase_10 AC 1,557 ms
111,140 KB
testcase_11 AC 1,556 ms
110,844 KB
testcase_12 AC 1,659 ms
110,884 KB
testcase_13 AC 1,570 ms
110,836 KB
testcase_14 WA -
testcase_15 AC 1,562 ms
110,892 KB
testcase_16 AC 1,557 ms
110,756 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1,559 ms
110,756 KB
testcase_20 AC 1,551 ms
110,828 KB
testcase_21 AC 1,555 ms
110,756 KB
testcase_22 AC 1,565 ms
110,824 KB
testcase_23 AC 1,570 ms
110,952 KB
testcase_24 AC 1,575 ms
111,144 KB
testcase_25 AC 1,566 ms
110,752 KB
testcase_26 AC 1,565 ms
111,020 KB
testcase_27 AC 1,568 ms
110,628 KB
testcase_28 AC 1,575 ms
110,760 KB
testcase_29 AC 1,560 ms
110,944 KB
testcase_30 AC 1,596 ms
110,876 KB
testcase_31 AC 1,575 ms
110,964 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,583 ms
110,620 KB
testcase_35 AC 1,575 ms
110,820 KB
testcase_36 AC 1,683 ms
114,220 KB
testcase_37 AC 1,594 ms
113,964 KB
testcase_38 AC 1,582 ms
114,152 KB
testcase_39 AC 1,572 ms
114,164 KB
testcase_40 AC 1,570 ms
115,616 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

#print(order)
#print(order2[:10])
#print(group[:5])
        
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