結果

問題 No.3823 Make 1
コンテスト
ユーザー kidodesu
提出日時 2026-11-22 13:30:40
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 496 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 80 ms
コンパイル使用メモリ 64,352 KB
実行使用メモリ 57,476 KB
最終ジャッジ日時 2026-11-22 13:30:47
合計ジャッジ時間 6,811 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    n = int(input())
    S = input()
    i = 0
    x = 0
    while i < n:
        j = i
        while j < n and S[i] == S[j]:
            j += 1
        c = j-i
        i = j
        if x % 2:
            c -= 1
            x -= 1
        x = x//2+c
    if S[-1] == "1":
        while not x % 4:
            x //= 4
        t = 1
    else:
        while not x % 4:
            x //= 4
        t = 2
    return "Yes" if x == t else "No"

for _ in range(int(input())):
    print(main())
0