結果
| 問題 |
No.2397 ω冪
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:15:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,062 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 106,588 KB |
| 最終ジャッジ日時 | 2025-04-15 21:21:34 |
| 合計ジャッジ時間 | 5,743 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 12 TLE * 1 -- * 4 |
ソースコード
def get_b_list(binary_str):
b_list = []
s = binary_str.lstrip('0') or '0' # Handle leading zeros
if s == '0':
return []
while s != '0':
reversed_s = s[::-1]
b = 0
# Count trailing zeros in the original string (leading zeros in reversed)
while b < len(reversed_s) and reversed_s[b] == '0':
b += 1
b_list.append(b)
# Remove the trailing 'b' zeros and the next 1, then process the remaining part
remaining_reversed = reversed_s[b+1:]
if not remaining_reversed:
new_s = '0'
else:
new_s = remaining_reversed[::-1].lstrip('0')
if not new_s:
new_s = '0'
s = new_s
# Sort the list in descending order
b_list.sort(reverse=True)
return b_list
# Read input
n_str = input().strip()
m_str = input().strip()
# Get the b lists for N and M
n_list = get_b_list(n_str)
m_list = get_b_list(m_str)
# Compare the two lists lexicographically
if n_list < m_list:
print("Yes")
else:
print("No")
lam6er