卡常 #pragma GCC optimize(2) #include<cstdio> #include<algorithm> #include<cstring> #include<vector> using namespace std; typedef long long LL; #define fi first #define se second #define mp make_pair #define pb push_back typedef pair…
思路清奇,代码简洁的好题 问题大体分两部: 记录子矩阵个数,统计每一个点作为右下角时可以得到多少矩形,加起来就是答案 剪掉墙挡住的地方 考虑从右下角开始,如果有0已经挡住了矩阵,那么更靠左.上的0都卵用没有->单调栈 #include<bits/stdc++.h> using namespace std; int n,m,a[3005][3005]; int up[3005],s[3005],top; long long sum[3005],ans=0; int main() { sca…