#include #include using namespace std; int main() { vector<char> st; vector<char> ans; int a; scanf("%d", &a); for (int i = 0; i "%s", &st); for (int i = 0; i if(st[i] == '(') //segement fault ans.push_back(st[i]); else if (st[i] == ')' && !ans.empty()) { if(ans.back() != '(') { printf("NO"); break; } ans.pop_back(); } else { printf("NO"); break; } } if (ans.empty()) printf("YES"); st.clear(); ans.clear(); } return 0; }

백준 9012번 문제인데 디버거 돌리니 주석 친 부분에서 자꾸 세그먼트 폴트 뜨네요.

벡터 자료형 때문인 것 같은데 도와주세요 ㅠㅠ