Memory Limit Exceed

Правка en2, от Aint_Stain, 2016-06-09 22:57:27

This code is showing MLE. Why?!!!!!!

include<bits/stdc++.h>

using namespace std; int main(void) { string a,b,c;

scanf("%s %s %s",&a,&b,&c);
a=a+b;
sort(a.begin(),a.end());
sort(c.begin(),c.end());
if(a==c)
    printf("YES");
else
    printf("NO");

return 0;

}

but when I using this code below it was accepted.What is the fact here between scanf and cin or else?

include<bits/stdc++.h>

using namespace std; int main(void) { string a,b,c;

cin>>a>>b>>c;
a+=b;
sort(a.begin(),a.end());
sort(c.begin(),c.end());
if(a==c)
    cout<<"YES";
else
    cout<<"NO";

return 0;

}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Aint_Stain 2016-06-09 22:58:51 12
en2 Английский Aint_Stain 2016-06-09 22:57:27 8
en1 Английский Aint_Stain 2016-06-09 22:56:33 674 Initial revision (published)