use proconio::marker::*; use proconio::*; use std::collections::*; type Map = BTreeMap; type Set = BTreeSet; type Deque = VecDeque; type Heap = BinaryHeap; const MOD: u64 = 998_244_353; fn main() { input! { n: usize, k: usize, s: Bytes, } // S が対応がとれた括弧列かどうか。 let mut v = 0; for &c in &s { if c == b'(' { v += 1; } else { if v == 0 { println!("No"); return; } else { v -= 1; } } } if v != 0 { println!("No"); return; } // 作ることのできる数字の下界 let mut x = n / 2; for i in 0..n - 1 { if s[i] == b'(' && s[i + 1] == b')' { x += 1; } } if x <= k { println!("Yes"); } else { println!("No"); } }