-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Not_a_Substring.cpp
More file actions
142 lines (136 loc) · 3.5 KB
/
A_Not_a_Substring.cpp
File metadata and controls
142 lines (136 loc) · 3.5 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// gl hf
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define bl bool
#define vct vector
#define ull unsigned long long
#define vi vector<ll>
#define vl vector<ll>
#define vb vector<bl>
#define pii pair<ll, ll>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define vp vector<pair<ll, ll>>
#define vs vector<string>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vpvp vector<pair<ll, pair<ll, ll>>>
#define Map map<ll, ll>
#define Set set<ll>
#define PQ priority_queue<ll>
#define MinPQ priority_queue<ll, vector<ll>, greater<ll>>
#define UM unordered_map<ll, ll>
#define US unordered_set<ll>
#define Stk stack<ll>
#define Que queue<ll>
#define Deque deque<ll>
#define OS ordered_set<ll>
#define Rep(i, a, b) for (ll i = (a); i <= (b); ++i)
#define For(i, n) for (ll i = 0; i < (n); ++i)
#define Rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define ForV(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define cinAll(v) \
for (auto &x : v) \
cin >> x;
#define coutAll(v) \
for (const auto &x : v) \
cout << x << " ";
#define sumAll(v) accumulate(v.begin(), v.end(), 0LL)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define sortAll(v) sort(v.begin(), v.end())
#define sortMax64(v) sort(v.begin(), v.end(), std::greater<ll>())
#define sortMax32(v) sort(v.begin(), v.end(), std::greater<int>())
#define py cout << "YES" << endl;
#define pn cout << "NO" << endl;
#define ps cout << " " << endl;
#define nocap true
#define cap false
#define dbg(x) cout << x << endl;
#define r return;
#define minAll(v) *min_element(v.begin(), v.end())
#define maxAll(v) *max_element(v.begin(), v.end())
#define firstSet(x) __builtin_ffs(x) - 1
#define countSet(x) __builtin_popcount(x)
#define leadingZeros(x) __builtin_clz(x)
#define trailingZeros(x) __builtin_ctz(x)
#define parityBit(x) __builtin_parity(x)
#define leadingSignBits(x) __builtin_clrsb(x)
#define byteSwap32(x) __builtin_bswap32(x)
#define byteSwap64(x) __builtin_bswap64(x)
#define addOverflow(a, b, res) __builtin_add_overflow(a, b, res)
#define subOverflow(a, b, res) __builtin_sub_overflow(a, b, res)
#define mulOverflow(a, b, res) __builtin_mul_overflow(a, b, res)
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = LONG_LONG_MAX;
const ll NEG = -1e9;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
os << "{ ";
for (const T &x : v)
os << x << " ";
os << "}";
return os;
}
void solve()
{
string s;
cin >> s;
string cd1 = "", cd2 = "";
For(i, s.length())
{
cd1 += "()";
cd2 += '(';
}
For(i, s.length())
{
cd2 += ')';
}
if (cd1.find(s) == string::npos)
{
py
dbg(cd1)
r
}
if (cd2.find(s) == string::npos)
{
py
dbg(cd2)
r
}
pn
}
// gg wp
int main()
{
const static auto fast = []()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
}();
ll t;
if (t != 1)
cin >> t;
while (t--)
{
solve();
}
return 0;
}