func_code_string: #include <bits/stdc++.h>   using namespace std;   int seq[100050];   int n;   int l[40], r[40];   int dp[100050];   bool chk() {     for (int i = 1; i <= n; ++i)       if (seq[i] != i) return false;     return true;   }   void dfs(int dep) {     if (chk()) {       printf( %d n , dep);       for (int i = dep; i >= 1; --i) printf( %d %d n , l[i], r[i]);       exit(0);     }     if (dep == 3) return;     for (int i = 1; i <= n - 1; ++i) {       if (seq[i] != i &&           (abs(seq[i] - seq[i - 1]) != 1 || abs(seq[i] - seq[i + 1]) != 1)) {         for (int j = i + 1; j <= n; ++j)           if (seq[j] != j &&               (abs(seq[j] - seq[j + 1]) != 1 || abs(seq[j] - seq[j - 1]) != 1)) {             l[dep + 1] = i;             r[dep + 1] = j;             reverse(seq + i, seq + j + 1);             dfs(dep + 1);             reverse(seq + i, seq + j + 1);           }       }     }   }   int main() {     seq[0] = -1;     scanf( %d , &n);     seq[n + 1] = -1;     for (int i = 1; i <= n; ++i) scanf( %d , &seq[i]);     dfs(0);   }   