結果

問題 No.3142 Balancing with O=>X Flip
ユーザー Nikkuniku029
提出日時 2025-05-16 21:39:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,660 KB
実行使用メモリ 73,536 KB
最終ジャッジ日時 2025-05-16 23:53:23
合計ジャッジ時間 2,416 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
S = input()
q = deque()
for s in S:
    if q:
        if q[-1] == "(" and s == ")":
            q.pop()
            continue
    q.append(s)
ans = "No" if q else "Yes"
print(ans)
0