Title: To a lattice, where there is no point, the operation is to remove a point, and ask the current lattice of the largest square
If not modified, the bare DP
Plus the changes, you can consider the time reversal, so the answer is incremental
can use and check the connectivity of the maintenance point, o^2
#include <bits/stdc++.h>using namespacestd;#defineMAXN 2010inlinevoidMIN (int&a,intb) {if(a>b) a=b;} InlinevoidMAX (int&a,intb) {if(a<b) a=b;}intN,m,q,sz;intF[MAXN][MAXN],U[MAXN][MAXN],LG[MAXN],RG[MAXN],QX[MAXN],QY[MAXN],ANS[MAXN];CharS[MAXN][MAXN];structline{intF[MAXN]; intFindintx) {returnf[x]==x?x:f[x]=find (F[x]);}} L[MAXN],R[MAXN];voidDelintXinty) {L[x].f[y]=l[x].find (y1); R[x].f[y]=r[x].find (y+1);}intMain () {scanf ("%d%d%d",&n,&m,&q); for(intI=1; i<=n;++i) for(intj=1; j<=m+1;++j) {L[i].f[j]=J; R[I].F[J]=J; U[I][J]=i; } for(intI=1; i<=n;++i) scanf ("%s", s[i]+1); for(intI=1; i<=q;++i) scanf ("%d%d", &qx[i],&qy[i]), s[qx[i]][qy[i]]='X'; for(intI=1; i<=n;++i) for(intj=1; j<=m;++j)if(s[i][j]=='.') del (I,J); for(intI=1; i<=n;++i) for(intj=1; j<=m;++j)if(s[i][j]=='.') {U[i][j]=u[i-1][j]; F[I][J]=min (f[i-1][j-1]+1, Min (i-u[i][j],j-L[i].find (j))); MAX (Sz,f[i][j]); } for(intv=q;v;--v) {Ans[v]=sz; Del (Qx[v],qy[v]); for(intI=1; i<=n;++i) {Lg[i]=qy[v]-L[i].find (Qy[v]); Rg[i]=r[i].find (Qy[v])-Qy[v]; } for(inti=qx[v]-1; i>=1; i) MIN (lg[i],lg[i+1]), MIN (rg[i],rg[i+1]); for(inti=qx[v]+1; i<=n;++i) MIN (lg[i],lg[i-1]), MIN (rg[i],rg[i-1]); for(intI=1; i<=qx[v];++i) while(I+sz<=n&&min (Rg[i],rg[i+sz]) +min (Lg[i],lg[i+sz])-1>sz)++sz; } for(intI=1; i<=q;++i) printf ("%d\n", Ans[i]); return 0;}
View Code
CODEFORCES480E Parking IoT