fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n, i;
  7. cin >> n;
  8. int a[n+2];
  9. a[0]=-1; a[n+1]=-1;
  10. for(i=1; i<=n; i++) cin>>a[i];
  11. for (i=1; i<=n; i++)
  12. if(a[i]>a[i-1] && a[i]>a[i+1]) cout<<'E';
  13. else cout<<'M';
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5292KB
stdin
5
1
2
1
4
5
stdout
MEMME