結果
| 問題 | No.3142 Balancing with O=>X Flip |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-09-29 14:45:39 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 46 ms / 2,000 ms |
| + 871µs | |
| コード長 | 863 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 82,628 KB |
| 実行使用メモリ | 76,408 KB |
| 最終ジャッジ日時 | 2026-09-29 14:45:42 |
| 合計ジャッジ時間 | 2,913 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
import collections
import sys
from math import gcd
from typing import List, Tuple
MOD = 998244353
int1 = lambda x: int(x) - 1
input = lambda: sys.stdin.readline().rstrip('\n')
ii = lambda: int(input())
vi = lambda: list(map(int, input().split()))
vi1 = lambda: list(map(int1, input().split()))
def dbg(*args, **kwargs):
print(*(repr(arg) for arg in args), *(f'{k}: {repr(v)}' for k, v in kwargs.items()),
sep='; ', file=sys.stderr, flush=True)
def main():
input()
s = input()
a = 0
for c in s:
if c == ')':
a -= 1
else:
a += 1
if a < 0:
return 'No'
return 'Yes' if a == 0 else 'No'
def _start():
if (ret := main()) is not None:
print(*ret) if isinstance(ret, List) or isinstance(ret, Tuple) else print(ret)
if __name__ == '__main__':
_start()