QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#748918#7894. Many Many Headssurenjamts#WA 0ms3592kbC++20666b2024-11-14 21:57:452024-11-14 21:57:46

Judging History

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

  • [2024-11-14 21:57:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-11-14 21:57:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define S second
#define F first
void solve(){
   string s;
   cin >> s;
   int n = s.size();
   vector<int> stk;
   int cnt = 0;
   for(int i = 0; i < n; i++){
       int num = 0;
       if(s[i] == '[' || s[i] == ']') num = 1;
       if(stk.empty()) cnt++, stk.push_back(num);
       else {
          if(stk.back() == num) stk.pop_back();
          else stk.push_back(num);
       }
   }
   //cout << cnt << endl;
   if(cnt > 1) cout << "No\n";
   else cout << "Yes\n";

}
int main(){
	 int t;  cin >> t; while(t--) solve();
}

詳細信息

Test #1:

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

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: 3592kb

input:

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

output:

No
No

result:

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