Codeforces Round 513 (Div.1+Div.2)
10月4号的比赛,因为各种原因(主要是懒),今天才写总结……
Div1+Div2,只做出两个题+迟到\(20min\),日常掉\(rating\)……
\(\rm{A.Phone\;Numbers}\)
很水的一道题目,直接输出cout<<min(n/11,tot);(\(tot\)为数字\(8\)的数量)
\(\mathcal{Maximum\;Sum\;of\;Digits}\)
一点小贪心,我们让\(9\)最多就行了,证明吗……感性的理解一下吧
\(\mathfrak{Maximum\;Subrectangle}\)
因为矩阵的元素\(C_{i,j}=a_i\times b_i\),所以
\(\sum_{i=x_1}^{x2}{\sum_{j=y_1}^{y2}{C_{i,j}}}=(sumx[x_2]-sumx[x_1-1])\times (sumy[x_2]-sumy[x_1-1])\)
其中sumx和sumy是\(a\)数列和\(b\)数列的前缀和。这样我们就可以\(O(n^2)\)处理出子矩阵长一定时候的最小值和宽一定时的最小值,然后\(O(1)\)判断。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long sumx[2010],sumy[2010],minx[2010],miny[2010];
long long read(){
int k=0,f=1; char c=getchar();
for(;c<'0'||c>'9';c=getchar())
if(c=='-') f=-1;
for(;c>='0'&&c<='9';c=getchar())
k=k*10+c-48;
return k*f;
}
int main(){
int n=read(),m=read();
memset(minx,127,sizeof(minx)), memset(miny,127,sizeof(miny));
for(int i=1;i<=n;i++) sumx[i]=sumx[i-1]+read();
for(int i=1;i<=m;i++) sumy[i]=sumy[i-1]+read();
//====预处理长宽一定时的最小值
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
minx[i]=min(minx[i],sumx[j]-sumx[j-i]);
}
}
//====判断并记录ans
for(int i=1;i<=m;i++){
for(int j=i;j<=m;j++){
miny[i]=min(miny[i],sumy[j]-sumy[j-i]);
}
}
int x=read(),ans=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++)
if(minx[i]*miny[j]<=x) ans=max(ans,i*j);
}
cout<<ans;
return 0;
}
Codeforces Round 513 (Div.1+Div.2)的更多相关文章
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- Educational Codeforces Round 39 (Rated for Div. 2) G
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...
- Educational Codeforces Round 48 (Rated for Div. 2) CD题解
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...
- Educational Codeforces Round 60 (Rated for Div. 2) 题解
Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...
随机推荐
- SLAM的现在与未来
http://geek.csdn.net/news/detail/202128 作者:高翔,张涛,刘毅,颜沁睿. 编者按:本文节选自图书<视觉SLAM十四讲:从理论到实践>,系统介绍了视觉 ...
- Shader 模板缓冲和模板测试
http://blog.sina.com.cn/s/blog_6e159df70102xa67.html 模板缓冲的概念 Unity官方的Shader文档根本没有提到这个玩意,这个概念也是看到了UGU ...
- CF1045B Space Isaac(乱搞)
翻译 有0~m-1的数被分成了两个集合每次你可以从两个集合中任取一个数做加法并对m取模问最后0~m-1中不能被组合出来的数有多少个会给出你A集合 大小不超过200000m<=1e9 完了题解都看 ...
- 微服务监控神器Prometheus的安装部署
本文涉及:如何在k8s下搭建Prometheus+grafana的监控环境 基本概念 Prometheus提供了容器和云原生领域数据搜集.存储.处理.可视化和告警一套完整的解决方案,最初时是由Soun ...
- 根据经纬度反向地理编译出地址信息(如果报错:Error Domain=kCLErrorDomain Code=8 "(null)")
注意:Error Domain=kCLErrorDomain Code=8 "(null)" 如果出现这个错误 一定是 经纬度有问题 一定是 经纬度有问题 一定是 经纬度有问 ...
- ubuntu 16.04 单用户____修改忘记密码
1.开机按ESC,出现如下界面,选中如下选项 2.按回车键进入如下界面,然后选中有recovery mode的选项 3.按e进入如下界面,找到图中红色框的recovery nomodeset并将其删掉 ...
- 1e9个兵临城下(容斥原理)
链接:https://ac.nowcoder.com/acm/contest/321/A 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536 ...
- 从wireshake分析http和https的通信过程
参考文章: Wireshark基本介绍和学习TCP三次握手 [技术流]Wireshark对HTTPS数据的解密 Wireshark/HTTPS Journey to HTTP/2 以TCP/IP协议为 ...
- 配置本地和远程maven仓库
<mirrors><mirror> <id>alimaven</id> <name>aliyun maven</name> &l ...
- RDL Web报表抛出ReportServerException,已取消该操作
::, RsBase() [ERROR] - Microsoft.Reporting.WebForms.ReportServerException: 已取消该操作. ---> System.Op ...