diff --git a/Codes/1913B Swap and Delete/1913B.cpp b/Codes/1913B Swap and Delete/1913B.cpp index c98fdca..bf30f22 100644 --- a/Codes/1913B Swap and Delete/1913B.cpp +++ b/Codes/1913B Swap and Delete/1913B.cpp @@ -61,54 +61,21 @@ void solve() { string s; cin>>s; - if(sz(s)==1) + int n=sz(s); + vectorcnt(2,0); + for(int i=0; ict0) - { - diff=ct1-ct0; - for(int i=sz(s); i>=0; --i) + int x=(s[i]-'0')^1; + if(cnt[x]==0) { - if(s[i]=='1') - { - diff--; - } - if(diff==0) - break; - ans++; + cout<< n-i<=0; --i) - { - if(s[i]=='0') - { - diff--; - } - if(diff==0) - break; - ans++; - } - } - cout<