Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
23992 | liuyile | 【BJ】T2 | C++ | 通过 | 100 | 10 MS | 304 KB | 976 | 2023-12-07 19:01:58 |
#include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #define lc(x) ((x) << 1) #define rc(x) ((x) << 1 | 1) //#define double long double #define pii pair<int,int> #define p1(x) ((x).first) #define p2(x) ((x).second) map<pii,int>S; int n; const int M=998244353; signed main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); // freopen("s4.in","r",stdin); //freopen("rec.in", "r", stdin); //freopen("rec.out", "w", stdout); cin>>n; for(int i=1;i<=n;i++){ string s; map<pii,int>ct; cin>>s; int now=0; int w=0; int len=0; for(char x:s){ if(x=='('){ now++; w=(w<<1|1)%M; } else{ now--; w=(w<<1)%M; } len++; if(now==0){ ct[{len,w}]++; len=w=0; } } for(auto e:ct){ S[p1(e)]^=p2(e); if(!S[p1(e)]) S.erase(p1(e)); } cout<<!S.empty()<<endl; } cout.flush(); return 0; }