結果

問題 No.3142 Balancing with O=>X Flip
コンテスト
ユーザー わん
提出日時 2025-10-20 21:56:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 166 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 66,364 KB
最終ジャッジ日時 2025-10-20 21:56:52
合計ジャッジ時間 2,487 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
fl = 1
cnt = 0
for c in S:
  x = 1 if c=='(' else -1
  cnt += x
  if cnt < 0:
    fl = 0
    break
print("Yes" if fl and cnt==0 else"No")
0