/* -*- coding: utf-8 -*- * * 3141.cc: No.3141 Balancing with X=>O Flip - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ /* global variables */ char s[MAX_N + 4]; /* subroutines */ /* main */ int main() { int n; scanf("%d%s", &n, s); int c0 = 0; for (int i = 0; i < n; i++) c0 += (s[i] == '(') ? 1 : 0; int c1 = n - c0; if (c0 == c1) puts("Yes"); else puts("No"); return 0; }