結果

問題 No.3140 Weird Parentheses Game
ユーザー norioc
提出日時 2025-05-16 21:52:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 83,012 KB
実行使用メモリ 54,060 KB
最終ジャッジ日時 2025-05-16 21:52:31
合計ジャッジ時間 1,884 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()


def is_balanced(s: str) -> bool:
    d = 0
    for c in S:
        if c == '(':
            d += 1
        elif c == ')':
            if d == 0:
                return False
            d -= 1

    return d == 0


if is_balanced(S):
    print('First')
else:
    print('Second')
0