func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 2e5 + 100;   int a[M], b[M];   int n, x, y;   int di[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};   bool check(int xx, int yy) {     if (xx < 1 || xx > x || yy < 1 || yy > y) return 0;     return 1;   }   bool bfs() {     queue<int> q;     int l = 0;     q.push(a[l]);     l++;     while (q.size()) {       if (l == n) return 1;       int ans = q.front();       int y1, x1;       if (ans % y == 0) {         y1 = y;         x1 = ans / y;       } else {         y1 = ans % y;         x1 = ans / y + 1;       }       q.pop();       for (int i = 0; i < 4; i++) {         int nx = x1 + di[i][0], ny = y1 + di[i][1];         int res = (nx - 1) * y + ny;         if (check(nx, ny) && res == a[l]) {           q.push(a[l]);           l++;           break;         }       }     }     if (l == n + 1)       return 1;     else       return 0;   }   int main() {     while (~scanf( %d , &n)) {       int mac = 0;       for (int i = 0; i < n; i++) {         scanf( %d , &a[i]);         mac = max(a[i], mac);       }       int l = 0;       bool f = 1;       for (int i = 0; i < n - 1; i++) {         if (l == 0 && abs(a[i] - a[i + 1]) > 1) l = abs(a[i] - a[i + 1]);         if (l && abs(a[i] - a[i + 1]) > 1)           if (l != abs(a[i] - a[i + 1])) {             f = 0;             break;           }       }       if (!f)         printf( NO n );       else {         if (l == 0) {           x = 1;           y = mac;         } else {           y = l;           x = mac / l + 1;         }         bool tt = bfs();         if (tt) {           printf( YES n );           printf( %d %d n , x, y);         } else           printf( NO n );       }     }     return 0;   }   