Quantcast
Viewing all articles
Browse latest Browse all 39796

WA in NAME2

                    #include<iostream>
                #include<algorithm>

                using namespace std;


                class test{
                public:
                    string f,l;
                };

                bool ispresent( char ch , string &k )
                {

                    for(int i=0;i<k.size();i++)
                    {
                        if(k.at(i)==ch)
                        {
                            k.erase( (k.begin()+i) );
                            return true;
                            break;
                        }
                    }

                    return false;


                }


                int main(){
                    std::ios_base::sync_with_stdio(false);
                    string::iterator it;
                    int t;
                    bool c;
                    cin>>t;
                    test s[t];
                    for(int i=0;i<t;i++)
                        cin>>s[i].f>>s[i].l;

                     for(int i=0;i<t;i++)
                     {
                         c=true;
                        sort(s[i].f.begin() , s[i].f.end());
                        it= unique(s[i].f.begin() , s[i].f.end());
                        while(  (count(s[i].f.begin(), s[i].f.end() , *it ) <= count(s[i].l.begin(), s[i].l.end() , *it ))   && (it>=s[i].f.begin()) )
                        {
                            it--;
                        }

                         if(it==(s[i].f.begin()-1))
                            cout<<"YES";
                         else
                            cout<<"NO";

                         cout<<endl;
                     }



                return 0;
                }

getting WA , any hopes? , My submission id : 4093892

Thanks


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>