QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#276508#7894. Many Many Headsmiku_HYWA 0ms3484kbC++202.8kb2023-12-05 22:10:482023-12-05 22:10:48

Judging History

你现在查看的是最新测评结果

  • [2023-12-05 22:10:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3484kb
  • [2023-12-05 22:10:48]
  • 提交

answer

/*[[
 ⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷ ]],[[
 ⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇ ]],[[
 ⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽ ]],[[
 ⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕ ]],[[
 ⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕ ]],[[
 ⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕ ]],[[
 ⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄ ]],[[
 ⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕ ]],[[
 ⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿ ]],[[
 ⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ]],[[
 ⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟ ]],[[
 ⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠ ]],[[
 ⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙ ]],[[
 ⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣ ]],*/
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
using ll =long long ;
using pii =pair<int,int>;
using pll=pair<ll,ll>;
using pcc=pair<char,char>;
bool cmp(pll a,pll b){
	return a.y<b.y;
}
struct cmp1{
    bool operator()(pair<ll,ll>a,pair<ll,ll>b){
	if(a.x==b.x)return a.y>b.y;
	return a.x>b.x; 
}
};
const int mod=998244353;
ll ksm(ll a,ll b){
	ll ans=1;
	while(b){
		if(b&1){
			ans*=a;
		ans=ans%mod;
		}
		a=a*a;a%=mod;
		b>>=1;
	}
	return ans;
}
ll gcd(ll a,ll b){
	ll t=a%b;
	while(t){
		a=b;
		b=t;
		t=a%b;
	}
	return b;
}
ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
ll get_inv(ll x){
	return ksm(x,mod-2);
}
const int N=1e6+10;
string w="((((";
string e="[[[[";
void solve(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]==')')s[i]='(';
		if(s[i]==']')s[i]='[';
	}
	if(s.find(w)!=string::npos){cout<<"No"<<endl;
	return ;
	}
	if(s.find(e)!=string::npos){
		cout<<"No"<<endl;
		return ;
	}
	if(s.size()<4){
		cout<<"Yes"<<endl;
		return ;
	}
	int x=0,y=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='(')x++;
		else y++;
	}
	
	if(x>=4){
		if(s.find("((")!=string::npos){
			cout<<"No"<<endl;
			return ;
		}
	}
	if(y>=4&&s.find("[[")!=string::npos){
			cout<<"No"<<endl;
			return ;
	}
	cout<<"Yes"<<endl;
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	int _=1;
	cin>>_;
	while(_--)solve();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3484kb

input:

6
))
((()
[()]
()[()]()
([()])
([])([])

output:

Yes
No
Yes
No
No
No

result:

wrong answer expected YES, found NO [5th token]