QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#317317 | #7894. Many Many Heads | wullaaa | Compile Error | / | / | C++14 | 693b | 2024-01-28 20:29:06 | 2024-01-28 20:29:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,stk[N],top,cnt;
char s[N];
int main(){
int T; scanf("%d",&T);
while(T--){
scanf("%s",s+1),n=strlen(s+1),cnt=top=0;
bool flag=false,f=false; int las=-1;
for(int i=1;i<=n;++i){
int t=(s[i]=='('||s[i]==')');
if(top&&stk[top]==t) flag=true,--top;
else if(!top){
if(t==las){ f=true; break;
las=t,flag=false,++cnt,stk[++top]=t;
}else if(flag){ f=true; break; }
else stk[++top]=t;
if(cnt>2){ f=true; break; }
}
puts(f?"No":"Yes");
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:25:2: error: expected ‘}’ at end of input 25 | } | ^ answer.code:6:11: note: to match this ‘{’ 6 | int main(){ | ^ answer.code:7:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | int T; scanf("%d",&T); | ~~~~~^~~~~~~~~ answer.code:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%s",s+1),n=strlen(s+1),cnt=top=0; | ~~~~~^~~~~~~~~~