时间限制 14 s \rm 14s 14s…
分治然后根据单调性更新就行了。
A C C o d e \rm \color{silver} AC \ Code AC Code
#include<bits/stdc++.h>
#define maxn 2505
using namespace std;
int n,m,k;
char s[maxn][maxn];
int sm[maxn][maxn],pl[10],pr[10];
#define LL long long
LL ans = 0;
inline int calc(int l1,int l2,int r1,int r2,int e){
if(