結果

問題 No.2397 ω冪
ユーザー maguroflymagurofly
提出日時 2023-07-29 01:09:55
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 23,296 KB
最終ジャッジ日時 2024-04-16 08:57:19
合計ジャッジ時間 9,741 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
12,160 KB
testcase_01 AC 89 ms
12,288 KB
testcase_02 AC 92 ms
12,160 KB
testcase_03 AC 91 ms
12,288 KB
testcase_04 AC 89 ms
12,160 KB
testcase_05 AC 90 ms
12,160 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 90 ms
12,288 KB
testcase_09 WA -
testcase_10 AC 91 ms
12,288 KB
testcase_11 WA -
testcase_12 AC 93 ms
12,288 KB
testcase_13 AC 92 ms
12,288 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 92 ms
12,288 KB
testcase_17 AC 91 ms
12,160 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 89 ms
12,288 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 90 ms
12,160 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 102 ms
12,288 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 1,073 ms
19,584 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def str_to_ord(s)
	n = s.size
	indices = [0] + (0 ... n).filter { |i| s[i] == "1" }
	a = indices.each_cons(2).map { |l, r| int_to_ord(r - l) }
	a.sort!
	a.reverse!
	a.flatten
end

def int_to_ord(n, d = 0)
	if n == 0
		return [d]
	end
	xs = []
	while n > 0
		b = 0
		while n & 1 == 0
			b += 1
			n >>= 1
		end
		xs << b
		n >>= 1
	end
	ys = xs.map { |m| int_to_ord(m, d + 1) }
	ys.sort!
	ys.reverse!
	[d] + ys.flatten
end

N = str_to_ord(gets.chomp)
M = str_to_ord(gets.chomp)

puts ((N <=> M) < 0) ? "Yes" : "No"
0