QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#706270 | #7894. Many Many Heads | q1w2e3r4# | WA | 11ms | 3652kb | C++14 | 647b | 2024-11-03 09:53:40 | 2024-11-03 09:53:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 1e6 + 10;
string str;
int a[MAXN];
void prepare(){
cin >> str;
int N = str.size();
for(int i = 1; i <= N; i++){
if(str[i-1] == '(' || str[i-1] == ')') a[i] = 1;
else a[i] = 2;
}
int cnt[3] = {0,0,0};
for(int i = 2; i <= N; i++){
if(a[i] == a[i-1]){
cnt[a[i]]++;
}
}
if(cnt[1] <= 1 && cnt[2] <= 1) cout << "Yes\n";
else cout << "No\n";
}
signed main(){
ios::sync_with_stdio(false);
int T;
cin >> T;
while(T--){
prepare();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
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: 0
Accepted
time: 0ms
memory: 3556kb
input:
2 (([([[([ ]]))])]])]
output:
Yes No
result:
ok 2 token(s): yes count is 1, no count is 1
Test #3:
score: -100
Wrong Answer
time: 11ms
memory: 3652kb
input:
15134 ][ )( )([[ [)([ )][) ]])( ([]([] ]]))][ [([](] ()[))] ][(]]( ([()[) ()[](( [)([)( ]]([[)]] )[()])]] ))[](([] ](([((]] ))[)][)[ [)])([(] [()[]))[ )][(]()] [[((]()] ((]])[[) ])(](]]) )]]()[]( ([)[])]) [[)[()]( ([[)[[() [[)([])) [)[[)[() ))[(([)( ()][)[](]] [()]([[([[ )[]))][)][ )]([]([(][ [])])(...
output:
Yes Yes Yes Yes Yes Yes No No Yes No No Yes No No No Yes No No Yes Yes No Yes No No Yes No Yes Yes No No Yes No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No Yes No No No No No No No No No No No No No No No No No No No No Yes No No No No No No No No No No No No...
result:
wrong answer expected YES, found NO [7th token]