-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path599-in-game-chat.cpp
More file actions
46 lines (45 loc) · 920 Bytes
/
Copy path599-in-game-chat.cpp
File metadata and controls
46 lines (45 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* In-game Chat [1411A]
* Problem: https://codeforces.com/problemset/problem/1411/A
* Verdict: ACCEPTED Solved: 2021-04-14
* Language: C++17 (GCC 7-32)
* Runtime: 30 ms Memory: 0 KB
* Tags: implementation
* Author: BidoTeima
* Source: https://codeforces.com/contest/1411/submission/113013595
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
#define MOD ll(1e9+7)
ll gcd(ll a, ll b) {
return (b == 0 ? abs(a) : gcd(b, a % b));
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
ll pow(ll a, ll b) {
ll res = 1;
while (b--)res *= a;
return res;
}
int main()
{
ios::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int tt = 1;
cin >> tt;
while (tt--) {
int n;
cin >> n;
string s;
cin >> s;
int cnt = 0,i=n-1;
while (i >= 0 && s[i--] == ')')++cnt;
if (cnt > n - cnt) cout << "Yes\n";
else cout << "No\n";
}
return 0;
}