二次联通门 : LibreOJ #527. 「LibreOJ β Round #4」框架

/*
LibreOJ #527. 「LibreOJ β Round #4」框架 %% xxy dalao
对于每一个小方格
统计一下顶边向右延伸出几条边
左边的边向下延伸出几条边 后枚举每个小方格即可
*/
#include <cstdio>
#include <iostream> const int BUF = ;
char Buf[BUF], *buf = Buf; inline void read (int &now)
{
for (now = ; !isdigit (*buf); ++ buf);
for (; isdigit (*buf); now = now * + *buf - '', ++ buf);
} #define Max 1005
int h[Max][Max], l[Max][Max], Answer; int Main ()
{
fread (buf, , BUF, stdin);
int N, M, x; read (N), read (M); register int i, j, k;
for (i = ; i <= N; ++ i)
for (j = ; j < M; ++ j) read (h[i][j]);
for (i = ; i < N; ++ i)
for (j = ; j <= M; ++ j) read (l[i][j]);
for (i = ; i <= N; ++ i)
for (j = M - ; j; -- j)
if (h[i][j]) h[i][j] += h[i][j + ];
for (j = ; j <= M; ++ j)
for (i = N - ; i; -- i)
if (l[i][j]) l[i][j] += l[i + ][j];
for (i = ; i < N; ++ i)
for (j = ; j < M; ++ j)
for (k = ; h[i][j] >= k && l[i][j] >= k; ++ k)
if (h[i + k][j] >= k && l[i][j + k] >= k) ++ Answer;
printf ("%d", Answer);
return ;
} int ZlycerQan = Main ();
int main (int argc, char *argv[]) {;}

LibreOJ #527. 「LibreOJ β Round #4」框架的更多相关文章

  1. LibreOJ #517. 「LibreOJ β Round #2」计算几何瞎暴力

    二次联通门 : LibreOJ #517. 「LibreOJ β Round #2」计算几何瞎暴力 /* LibreOJ #517. 「LibreOJ β Round #2」计算几何瞎暴力 叫做计算几 ...

  2. LibreOJ #528. 「LibreOJ β Round #4」求和

    二次联通门 : LibreOJ #528. 「LibreOJ β Round #4」求和 /* LibreOJ #528. 「LibreOJ β Round #4」求和 题目要求的是有多少对数满足他们 ...

  3. LibreOJ #526. 「LibreOJ β Round #4」子集

    二次联通门 : LibreOJ #526. 「LibreOJ β Round #4」子集 /* LibreOJ #526. 「LibreOJ β Round #4」子集 考虑一下,若两个数奇偶性相同 ...

  4. LibreOJ #525. 「LibreOJ β Round #4」多项式

    二次联通门 : LibreOJ #525. 「LibreOJ β Round #4」多项式 官方题解 : /* LibreOJ #525. 「LibreOJ β Round #4」多项式 由于会有多种 ...

  5. LibreOJ #524. 「LibreOJ β Round #4」游戏

    二次联通门 : LibreOJ #524. 「LibreOJ β Round #4」游戏 /* LibreOJ #524. 「LibreOJ β Round #4」游戏 找找规律就会发现.. 当有X的 ...

  6. LibreOJ #507. 「LibreOJ NOI Round #1」接竹竿

    二次联通门 : LibreOJ #507. 「LibreOJ NOI Round #1」接竹竿 /* LibreOJ #507. 「LibreOJ NOI Round #1」接竹竿 dp 记录一下前驱 ...

  7. LibreOJ #516. 「LibreOJ β Round #2」DP 一般看规律

    二次联通门 : LibreOJ #516. 「LibreOJ β Round #2」DP 一般看规律 /* LibreOJ #516. 「LibreOJ β Round #2」DP 一般看规律 set ...

  8. LibreOJ #6191. 「美团 CodeM 复赛」配对游戏

    二次联通门 : LibreOJ #6191. 「美团 CodeM 复赛」配对游戏 /* LibreOJ #6191. 「美团 CodeM 复赛」配对游戏 概率dp */ #include <cs ...

  9. LibreOJ #6212. 「美团 CodeM 决赛」melon

    二次联通门 : LibreOJ #6212. 「美团 CodeM 决赛」melon /* LibreOJ #6212. 「美团 CodeM 决赛」melon MDZZ 这是决赛题?? */ #incl ...

随机推荐

  1. [LOJ6432] [PKUSC2018] 真实排名

    题目链接 LOJ:https://loj.ac/problem/6432 Solution 假设我们当前要算\(x\)的答案,分两种情况讨论: \(x\)没被翻倍,那么\([a_x/2,a_x]\)这 ...

  2. backpropagation algorithm

    搞卷积神经网络的时候突然发现自己不清楚神经网络怎么训练了,满脸黑线,借此机会复习一下把. 首先放一位知乎大佬的解释.https://www.zhihu.com/question/27239198?rf ...

  3. navicat 连接 mysql 提示Client does not support authentication protocol requested by server错误

    安装完mysql后,命令行登录没问题,但是用Navicat连接出现提示性错误.Mysql版本为:8.0.15 命令如下: 1.use mysql; 2.alter user 'root'@'local ...

  4. 支付宝支付回调方法RSA2验签失败处理方法

    支付宝支付签名方式RSA2生成支付时使用的是支付宝公钥和应用私钥, 而不是应用公钥,支付宝公钥的生成是根据上传应用公钥而变动的, 所以在做回调的时候参数ALIPAY_PUBLIC_KEY也需要传支付宝 ...

  5. catch SocketException

    https://stackoverflow.com/questions/32810051/cannot-catch-socketexception/32810079#32810079 https:// ...

  6. iOS - 静态库的导入和头文件路径的设置

    开发过程中,免不了要用到一些第三方或者是别人写好的一些Demo,这时就经常会用到别人写的一些静态库(.a文件)和n多个头文件(.h文件),这些文件不是简单地把它们拉到自己的工程里面就行的,还要设置一些 ...

  7. DateTimePicker控件CustomFormat格式字符串及其说明

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/wuzhanwen/article/details/78800720格式字符串 描述 d 一个或两位数 ...

  8. input里面的提示文字修改(placeholder里的文字修改,el-input也适用)

    input::-webkit-input-placeholder { /* WebKit browsers */ color: red; } input:-moz-placeholder { /* M ...

  9. adb server is out of date. killing... ADB server didn't ACK * failed to start daemon *……

    问题 使用 adb 命令的时候报错如下: adb server is out of date. killing... ADB server didn't ACK * failed to start d ...

  10. vue项目配置Mock.js

    扯在前面 最近一直在忙跳槽的事情,博客也好久没有更新了,上次更新还是去年,不出意外的话,从今天起继续今年的博客之旅. 今天继续完善我之前的项目架构,从零开始搭建vue移动端项目到上线,有需要的同学可以 ...