比赛传送门

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. Java IO 输入和输出流

    数据流是指一组有顺序的,有起点和终点的字节集合. 最初的版本中,java.io 包中的流只有普通的字节流,即以 byte 为基本处理单位的流.字节流用来读写 8 位的数据,由于不会对数据做任何转换,因 ...

  2. Macbook 修复Office Excel 异常问题

    manbook 版本的office excel 在一次崩溃后,每次打开excel 文件都会弹出以下烦人的错误告警,并且每次都会重新打开很多过去保存过的excel 文件. “在应用程序意外退出之前,Ex ...

  3. EF升级 反射重载方法ApplyConfiguration

    protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); //var ...

  4. React中的代码分割

    代码分割想要解决的问题是:经打包工具

  5. symbol lookup error: /lib64/libpango-1.0.so.0: undefined symbol: g_log_structured_standard 错误

    通过更新glib2包修复.(yum update glib2)即可 拿走不谢,我也找得好辛苦!!!

  6. Mysql 5.7 账户过期重启

    关闭mysql 重启mysql57

  7. python进阶12 Redis

    python进阶12 Redis 一.概念 #redis是一种nosql(not only sql)数据库,他的数据是保存在内存中,同时redis可以定时把内存数据同步到磁盘,即可以将数据持久化,还提 ...

  8. yii2.0下,JqPaginator与Pjax实现无刷新翻页

    控制器部分 <?php namespace backend\controllers; use common\models\Common; use Yii; use yii\base\Contro ...

  9. feign客户端传参数报错

    新手经常遇到的错误 Caused by: java.lang.IllegalStateException: Method has too many Body parameters feign多参数问题 ...

  10. windows 安装 jdk1.8并配置环境变量

    1.查看电脑环境 我的电脑--右键--属性 2.下载jdk1.8 网址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-do ...