#include using namespace std; #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define test cout<<"test"<= (ll)(m); i--) typedef short ll; typedef long double ld; const ll MOD = 1e3; //const ll MOD = 998244353; const ll INF = 1e3; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>v,ll h,ll w){for(ll i=0;iv,ll h,ll w){for(ll i=0;i void debug(vectorv,ll n){cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} //m.emplace(x,0).fi->se++; struct z{ ll x; ll y; ll l; }; vector>k(2000,vector(2000,INF)); vector>>s(2000,vector>(2000)); vector a(2000); void bfs(ll h,ll w,queuep){ for(ll i=0;isecond++; //if(x<=h-2)p.push({x+1,y,l+1}); //if(y<=w-2)p.push({x,y+1,l+1}); short o=1; short u=x-o; short v=y-o; short w=l+o; if(x>=o)p.push({u,y,w}); if(y>=o)p.push({x,v,w}); if(x>=o&&y>=o)p.push({u,v,w}); } p.pop(); } } int main(){ cin.tie(NULL); ios_base::sync_with_stdio(false); ll res=0,res1=INF,res2=-INF,buf=0; bool judge = true; ll h,w,k;cin>>h>>w>>k; rep(i,0,h)cin>>a[i]; //test; vector>b(26); rep(i,0,h)rep(j,0,w){ b[a[i][j]-'a'].push({i,j,(ll)1}); } rep(i,0,26)bfs(h,w,b[i]); rep(i,0,h)rep(j,0,w){ s[i][j].emplace(min(h-i+1,w-j+1),0); ll countbuf=0; ll tmp=-1; for(auto z:s[i][j]){ countbuf+=z.se; //cout<min(h-i,w-j))break; } //cout<