比赛传送门

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])\)
其中sumxsumy是\(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)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  4. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  5. 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 ...

  6. 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 ...

  7. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  8. 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 < ...

  9. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  10. Educational Codeforces Round 60 (Rated for Div. 2) 题解

    Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...

随机推荐

  1. 3dmax————

    去掉阴影 建模中去掉阴影,有时候阴影会挡住视野 , 显示法线 转到可编辑网格,选择面,选择 ,注意下面那个比例调大点,否则看不清楚

  2. 剑指Offer的学习笔记(C#篇)-- 求1+2+3+...+n

    题目描述 求1+2+3+...+n,要求不能使用乘除法.for.while.if.else.switch.case等关键字及条件判断语句(A?B:C). 一 . 直接解题吧 芽儿呦,突然觉得,我不说! ...

  3. Java-GC-标记清除算法

    ## 前置知识 静态变量在类被加载的时候分配内存.当我们启动一个App的时候,系统会创建一个进程,此进程会加载一个JVM的实例,然后代码就运行在JVM之上.也就是说类在被加载的时候,静态变量 --- ...

  4. 服务器安装docker后免除sudo命令

    1. 先建立一个docker组:sudo groupadd docker 2. 将用户加入docker组:sudo usermod -aG docker (用户名) 3. 先退出登录:exit 4. ...

  5. 基于Vue的省市区三级联动插件

    官网地址:https://distpicker.uine.org/ 安装: npm install v-distpicker --save 局部注册: import VDistpicker from ...

  6. moment.js插件的简单上手使用

    开发过程中看长篇幅的技术文档是件多么影响多发效率的事情丫,哼哼,人家明明只是想用个简单的功能而已丫,下面文档很好的解决了这个问题,yeah~~~ 一.monent.js时间插件 1.Moment.js ...

  7. js异步加载和按需加载

    function loadScript(url,callback){ var script = document.creatElement("script"); script.ty ...

  8. CF438D The Child and Sequence 线段树

    给定数列,区间查询和,区间取模,单点修改. n,m小于10^5 ...当区间最值小于模数时,就直接返回就好啦~ #include<cstdio> #include<iostream& ...

  9. 关系型数据库---MySQL---数据表

    1.在创建一个新的MySQL数据表时,可以为它设置一个类型: 2.MySQL支持多种数据表类型,有各自的特点和属性,最重要的3种类型: 1.1 MyISAM 1.2 InnoDB 1.1 可以把Inn ...

  10. missfresh问题记录

    一.基本信息 1.登陆机器    ssh lina02@mjump.missfresh.net -p2222 二.问题 1.分页问题:job_id为空时能查询出来(笛卡尔乘积),需要加上AND res ...