QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#801823#7894. Many Many Headsjuan_123#WA 0ms3844kbC++14518b2024-12-07 09:58:072024-12-07 09:58:07

Judging History

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

  • [2024-12-07 09:58:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-12-07 09:58:07]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,k;
char s[500005];
int op[500005];
void solve(){
	scanf("%s",s+1);n=strlen(s+1);
	for(int i = 1;i<=n;i++){
		if(s[i]=='(' or s[i]==')')op[i]=1;else op[i]=2;
	}
	int cc = 0;
	for(int i = 1;i<n;i++)if(op[i]==op[i+1])++cc;
	if(cc==1)cout << "Yes" << endl;
	else cout << "No" << endl;
}
signed main(){
	srand(time(0));
	int t;cin >> t;
	while(t--)solve();
	return 0;
}/*
 6
 ))
 ((()
 [()]
 ()[()]()
 ([()])
 ([])([])
*/

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3844kb

input:

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

output:

Yes
No
Yes
No
Yes
No

result:

ok 6 token(s): yes count is 3, no count is 3

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3708kb

input:

2
(([([[([
]]))])]])]

output:

No
No

result:

wrong answer expected YES, found NO [1st token]