func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 7;   int a[1003][1003], p[maxn], num[maxn], n, m, vis[1003][1003];   long long k;   int dx[4] = {1, -1, 0, 0};   int dy[4] = {0, 0, 1, -1};   int fi(int x) { return p[x] == x ? x : p[x] = fi(p[x]); }   void uni(int x, int y) {     int p1 = fi(x), p2 = fi(y);     if (p1 == p2) return;     p[p1] = p2;     num[p2] += num[p1];     num[p1] = 0;   }   struct node {     int x, y, z;     node(int x1, int y1, int z1) { x = x1, y = y1, z = z1; }   };   bool cmp(node a, node b) { return a.x > b.x; }   vector<node> Q;   void solve(int x, int y, int z, int v) {     queue<node> Q;     Q.push(node(x, y, 0));     vis[x][y] = 1;     z--;     while (!Q.empty()) {       node now = Q.front();       Q.pop();       for (int i = 0; i < 4; i++) {         int xx = now.x + dx[i];         int yy = now.y + dy[i];         if (z == 0) continue;         if (xx <= 0 || xx > n) continue;         if (yy <= 0 || yy > m) continue;         if (vis[xx][yy]) continue;         if (a[xx][yy] < v) continue;         vis[xx][yy] = 1, z--;         Q.push(node(xx, yy, 0));       }     }     for (int i = 1; i <= n; i++, cout << endl)       for (int j = 1; j <= m; j++)         if (vis[i][j])           printf( %d  , v);         else           printf( 0  );   }   int main() {     scanf( %d%d%lld , &n, &m, &k);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         scanf( %d , &a[i][j]), Q.push_back(node(a[i][j], i, j));     for (int i = 0; i < maxn; i++) p[i] = i, num[i] = 1;     sort(Q.begin(), Q.end(), cmp);     for (int i = 0; i < Q.size(); i++) {       int v = Q[i].x;       if (v == 0) break;       int x = Q[i].y;       int y = Q[i].z;       for (int j = 0; j < 4; j++) {         int xx = x + dx[j];         int yy = y + dy[j];         if (a[xx][yy] >= v) uni((xx - 1) * m + yy, (x - 1) * m + y);       }       long long Num = k / v;       if (k % v) continue;       int fa = fi((x - 1) * m + y);       if (Num <= num[fa]) {         printf( YES n );         solve(x, y, Num, v);         return 0;       }     }     printf( NO n );   }   