F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_27955326_22361.cpp: In function 'int main()':
0_0_27955326_22361.cpp:39:420: error: expected '}' at end of input
   if(s[i]=='(')  {st.push(i);p=i;break;} }p++; while(p<=s.size()-1) {  if(s[p]=='(')st.push(p);  else  {   int k=st.empty()?0:st.top();   if(st.empty())      {p++;continue;}   vis[p]=k;   vis[k]=p;   if(!st.empty())st.pop();   up[p]=up[vis[p]]=st.empty()?-1:st.top();  }  p++; }}void  Read(int& x){ x=0; char c;int flag=0; while(c=getchar()) {  if(c>='0'&&c<='9')x*=10,x+=c-'0',flag=1;  else if(flag)break; }}int main(){ //freopen("rand.out", "r", stdin);    //freopen("w.out", "w", stdout); Read(t); while(t--) {  char ss[MAXN]={};  scanf("%s",ss);  string sss(ss);  s=sss;  len=s.size();  init();  long long loe=0;  make_vis();  for(int i=0;i<s.size();i++)   if(s[i]==')'&&vis[i]!=-1)    b[i]=b[vis[i]-1]+1;  for(int j=s.size()-1;j>=0;j--)      if(s[j]=='('&&vis[j]!=-1)          a[j]=a[vis[j]+1]+1;  for(int i=0;i<s.size();i++)  {   if(up[i]!=-1&&!ans[i]&&vis[i]!=-1)      ans[i]=ans[vis[i]]=ans[up[i]]+(long long)a[i]*b[vis[i]];   else if(up[i]==-1&&!ans[i]&&vis[i]!=-1)    ans[i]=ans[vis[i]]=(long long)a[i]*b[vis[i]];  }  for(int i=0;i<s.size();i++)  {   loe=(loe+ans[i]*(i+1)%zqf);  }  printf("%I64d\n",loe); }}
                                                                                                                                                                                                                                                                                                                                                                                                                                    ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2025-01-10 12:46:12, Gzip enabled