fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n;
  6. long x, y;
  7. bool increasing = true;
  8. cin >> n;
  9. cin >> x >> y;
  10. if (x >= y) {
  11. cout << 0;
  12. return 0;
  13. }
  14. int i = 2;
  15. while (i < n) {
  16. x = y;
  17. cin >> y;
  18. if (x == y){
  19. cout << 0;
  20. return 0;
  21. }
  22. if (increasing == false) {
  23. if (x < y) {
  24. cout << 0;
  25. return 0;
  26. }
  27. }
  28. if (increasing == true) {
  29. if (x > y) {
  30. increasing = false;
  31. }
  32. }
  33. i++;
  34. }
  35. if (increasing == true) {
  36. cout << 0;
  37. return 0;
  38. }
  39. cout << 1;
  40. return 0;
  41. }
Success #stdin #stdout 0.01s 5320KB
stdin
3 1 3 1
stdout
1