結果

問題 No.3142 Balancing with O=>X Flip
ユーザー Kana Nagata
提出日時 2025-05-17 01:18:22
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 12,170 ms
コンパイル使用メモリ 398,116 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-17 01:18:37
合計ジャッジ時間 13,705 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::input;

fn main() {
    input! {
        _n: usize,
        s: String,
    }
    let mut i = 0;
    let ans = s.chars().all(|c| {
        match c {
            '(' => i += 1,
            ')' => i -= 1,
            _ => unreachable!(),
        }
        i >= 0
    }) && i == 0;
    println!("{}", if ans { "Yes" } else { "No" });
}
0