Submission #2527392
Source Code Expand
#include<bits/stdc++.h> using namespace std; int main(){ string str; int ans=0; int fr=0,re=0; int po=0; for(int i=0;i<str.size();i++){ if(str[i]=='('){ fr++; }else{ if(fr==0){ re++; str[i]='('; ans++; po=max(i,po); } else fr--; } } if(fr){ int cntsp=0; for(int i=0;i<str.size();i++){ if(str[i]=='('){ cntsp++; if(cntsp>=2){ ans++; po(po,i); cntsp-=2; } }else{cntsp--;} } } cout<<ans+po<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 天下一魔力発電 |
User | shi |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 606 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:28:18: error: ‘po’ cannot be used as a function po(po,i); ^