poj 2019 Cornfields(二维RMQ)

解锁RK3588:内核模块签名与安全启动配置全攻略 RK3588作为一款高性能嵌入式SoC芯片,其内核模块签名与安全启动配置是保障系统安全的核心机制。本文详细介绍了RK3588的芯片特性,重点阐述了安全启动的硬件信任链原理和内核模块签名的实现方法。通过具体步骤演示了从密钥生成、模块签名到验证加载的完整流程,并深入解析了安全启动配置的硬件连接、软件工具准备、密钥烧录等关键环节。此外,还提出了防御旁路攻击和动态信任链扩展等高级安全策略,为RK3588在工业控制、智能安防等高安全要求场景中的应用提供了全面的安全解决方案。 阅读详情
Cornfields
Time Limit: 1000MS Memory Limit: 30000K
Total Submissions: 5310 Accepted: 2613

Description

FJ has decided to grow his own corn hybrid in order to help the cows make the best possible milk. To that end, he's looking to build the cornfield on the flattest piece of land he can find.

FJ has, at great expense, surveyed his square farm of N x N hectares (1 <= N <= 250). Each hectare has an integer elevation (0 <= elevation <= 250) associated with it.

FJ will present your program with the elevations and a set of K (1 <= K <= 100,000) queries of the form "in this B x B submatrix, what is the maximum and minimum elevation?". The integer B (1 <= B <= N) is the size of one edge of the square cornfield and is a constant for every inquiry. Help FJ find the best place to put his cornfield.

Input

* Line 1: Three space-separated integers: N, B, and K.

* Lines 2..N+1: Each line contains N space-separated integers. Line 2 represents row 1; line 3 represents row 2, etc. The first integer on each line represents column 1; the second integer represents column 2; etc.

* Lines N+2..N+K+1: Each line contains two space-separated integers representing a query. The first integer is the top row of the query; the second integer is the left column of the query. The integers are in the range 1..N-B+1.

Output

* Lines 1..K: A single integer per line representing the difference between the max and the min in each query.

Sample Input

5 3 1
5 1 2 6 3
1 3 5 2 7
7 2 4 6 1
9 9 8 6 5
0 6 9 3 9
1 2

Sample Output

5
 
题意:给出一个矩阵,k个询问,每个询问a b,输出以第a行第b列元素为左上角的大小为B*B的子矩阵中最大值与最小值之差。
思路:裸的二维RMQ
 
AC代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
#define ll long long
#define L(rt) (rt<<1)
#define R(rt) (rt<<1|1)

using namespace std;

const int INF = 1e9;
const int maxn = 250;

int a[maxn][maxn];
int pmax[maxn][maxn][15], pmin[maxn][maxn][15];
int n, d, q;
void init_rmq()
{
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            pmax[i][j][0] = pmin[i][j][0] = a[i][j];

    for(int i = 1; i <= n; i++)
        for(int k = 1; (1 << k) <= n; k++)
            for(int j = 1; j + (1 << k) - 1 <= n; j++)
            {
                pmax[i][j][k] = max(pmax[i][j][k - 1], pmax[i][j + (1 << (k - 1))][k - 1]);
                pmin[i][j][k] = min(pmin[i][j][k - 1], pmin[i][j + (1 << (k - 1))][k - 1]);
            }
}
int RMQ(int a,int b)
{
     int k = (int)(log(double(d)) / log(2.0));
     int maxans = 0, minans = INF;
     int l = b, r = b + d - 1;
     for(int i = a; i < a + d; i++)
     {
         maxans = max(maxans, max(pmax[i][l][k], pmax[i][r - (1 << k) + 1][k]));
         minans = min(minans, min(pmin[i][l][k], pmin[i][r - (1 << k) + 1][k]));
     }
     return maxans - minans;
}

int main()
{
    int x, y;
    while(~scanf("%d%d%d", &n, &d, &q))
    {
        for(int i = 1; i <= n; i++)
            for(int j = 1; j <= n; j++)
                scanf("%d", &a[i][j]);
        init_rmq();
        while(q--)
        {
            scanf("%d%d", &x, &y);
            printf("%d\n", RMQ(x, y));
        }
    }
    return 0;
}

【Proteus仿真】AT89C51单片机中断系列仿真——INT0中断控制LED小灯/INT0和INT1中断控制数码管 本文介绍了基于51单片机外部中断(INT0/INT1)的四个实践案例:1)INT0控制LED开关;2)INT0中断实现数码管计数/清零;3)INT0中断构建秒表功能(启动/暂停/清零);4)INT0/INT1双中断独立控制两组数码管计数。每个案例包含电路原理图、接线说明及完整源代码,重点演示了外部中断在硬件控制中的应用方法。附加硬件工程师笔试面试资料链接,涵盖器件知识、Multisim教程等内容,适合嵌入式学习者参考实践。(149字) 阅读详情

相关推荐

【WiFi软件开发】IOCTL和Netlink----用户空间和内核空间交互的两种方式

linux开发中通常会涉及用户空间和内核模块的交互。本文介绍了两种典型的用户空间和内核模块通信方式:ioctl和netlink

liuwe1ye的博客 2356

Cornfields - POJ 2019 单调队列

Cornfields Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5959   Accepted: 2934 Description FJ has decided to grow his own corn hybrid in order to help th

提比的强行AC 783

Isaac Sim 6 利用Replicator实现高效语义分割与实例分割(实践指南5.10)

本文详细介绍了如何利用Isaac Sim 6的Replicator工具高效生成语义分割和实例分割数据集。通过虚拟环境自动标注,效率提升20倍以上,特别适用于农业机器人等计算机视觉项目。文章包含环境配置、场景构建、批量标注技巧及实例分割处理等实战指南,帮助开发者快速掌握合成数据生成技术。

weixin_42526415的博客 273

POJ - 2019 Cornfields 二维RMQ

题意 给出n∗n的矩阵。给出n∗n的矩阵。给出n*n的矩阵。 多次查询(x,y)为左上顶点,长度为b的子矩阵的最大值最小值差。多次查询(x,y)为左上顶点,长度为b的子矩阵的最大值最小值差。多次查询(x,y)为左上顶点,长度为b的子矩阵的最大值最小值差。 题解 二维ST表二维ST表二维ST表 给出两种二维RMQ写法给出两种二维RMQ写法给出两种二维RMQ写法 Code1Code...

Uniontake 504

Latex参考文献中大写字母编译后自动变成了小写,如何保持原字母大写形式

bib文件参考文献中大写自动变为小写,如何保持原大写问题。Latex: 保持参考文献大小写,overleaf文献编译后,原大写字母自动变成了小写字母,如何保持原字母大写

我的个人博客 5808

TCMSP数据库+R语言实战:从网页爬虫到中药-靶点网络图的全流程解析

本文详细解析了如何使用R语言从TCMSP数据库抓取中药-靶点数据,并通过数据清洗、网络分析和可视化构建完整的中药作用机制研究流程。涵盖动态网页爬虫、ADME参数筛选、网络图构建及高级可视化技巧,为中医药现代化研究提供实用的生物信息学方法。

weixin_31304817的博客 350

Poj 2019 Cornfields【二维RMQ-------ST算法】

Cornfields Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6608   Accepted: 3234 Description FJ has decided to grow his own corn hybrid in order to help th

mengxiang000000 2017

Cadence Virtuoso IC618实战:手把手教你搭建OTA电路并完成AC仿真(附避坑指南)

本文详细介绍了在Cadence Virtuoso IC618环境下搭建OTA电路并完成AC仿真的全流程,包括环境准备、原理图绘制、仿真配置及常见报错解决方案。特别针对IC618版本特有的配置难题提供了避坑指南,帮助模拟集成电路设计工程师高效完成前仿真工作。

weixin_31902781的博客 285

【RMQ】Poj 2019 Cornfields (二维)

题意: 给出一个 N * N 的矩阵(行列的编号都是 1-n),有 q 组询问,每组询问包含 row,col ,代表从 row行 ,col列 开始的 b * b 大小的矩阵,使其 max-min 值最大 O(n * m * log(n) * log(m) - O(1) 方法 int t,n,m,l,r,q,b,x,y; int a[maxn][maxn]; int maxs[maxn][maxn][8][8]; int mins[maxn][maxn][8][8]; void RMQ(){ for

weixin_44745441的博客 156

支付域——“清算、结算、清结算”

本文深入探讨了支付系统中的清算和结算流程,包括核心流程、模块设计及特殊场景处理。文章详细阐述了交易收单、资金冻结、清分规则、清算批处理、结算出账等关键步骤,并讨论了交易失败、数据不一致、退款、汇率波动等异常情况的处理方法。

庄小焱 2581

借助AI搞定国社科“研究内容”部分!用Gemini 3 Pro轻松撰写6大模块,让基金本子效率质量更上一层楼

所谓研究整体框架,是对课题研究逻辑结构与技术路径的系统阐述,其核心在于通过研究目标分解、研究内容模块化与研究方法整合,构建一个层次清晰、逻辑严密、科学可行的研究体系。撰写要求:1)分要点、分层次列出主要研究内容,保持各部分之间的逻辑性、层次性与系统性;研究可行性可理解为开展本课题在理论基础、研究方法、研究条件、人员结构、平台支撑及外部协作等方面的可实施程度,可从内部条件与外部条件两个维度进行系统论证。研究背景为:我正在申报xxx年xxx(项目名称),课题名称为:xxx,拟采用的主要研究方法包括:xxx等;

智能AI让学术科研更容易 975

POJ--2019--Cornfields【二维RMQ】

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define PI acos(-1.0) #def

阳光照耀圣西罗 741

自定义Usecase/Pipeline

Summary of Custom Usecase and Pipeline Configuration in SA8650 QCX Framework This article elaborates on the complete process of customizing a new Usecase and Pipeline based on the SA8650 QCX framework to meet OEM and Tier1 customization requirements, with

qq_39257814的博客 943

POJ 2019 Cornfields(简单二维RMQ)

思路:二维RMQ #include #include #include using namespace std; const int MAXN=255; int val[MAXN][MAXN]; int dmin[MAXN][MAXN][8][8]; int dmax[MAXN][MAXN][8][8]; void initRMQ(int n,int m) { for(int i

围巾的ACM博客 553

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

POJ 2019 Cornfields [二维RMQ]

二维RMQ。求一个矩阵的子矩阵各元素的最大值与最小值之差。用int会超内存,改用short。 #include #include #include #include #include using namespace std; const int maxn = 255; int n, b, k; short dpmin[maxn][maxn][10][10]; short dpm

~飞呀,飞~ 1223

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

POJ 2019 Cornfields 二维RMQ

题目来源:POJ 2019 Cornfields 题意:求正方形二维区间最大最小值的差 思路:直接二维ST搞 试模版而已 #include #include #include using namespace std; const int maxn = 255; int dp[maxn][maxn][8][8]; int dp2[maxn][maxn][8][8]; int a[

嗯。 1104

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

POJ-2019 Cornfields(二维rmq)

题目思路 用二维rmq处理出矩阵的最大最小值,再输出 二维rmq 跟一维rmq的处理方式相同 区别在于一维只要注意一个方向 二维需要对两个方向进行处理 二维情况分成三类 令数组为dp[i][j][k][t] 1 k和t均为0 此时表示的是一个点 对这种情况可以先处理 dp[i][j][0][0]=mp[i][j]; 2 k=0但t!=0 或者是k!=0但t=0 此时的处理方式和一维一样 if(k) { dp[i][j][k][t]=max(dp[i][j][k-1][t],dp[i+(1<&

daydreamer23333的博客 203

POJ 2019 Cornfields (二维RMQ)

http://poj.org/problem?id=2019 题意:给定一个N∗NN∗NN*N的矩阵和一个整数B&nbsp;(1&lt;=B&lt;=N)B&nbsp;(1&lt;=B&lt;=N)B\ (1 KKK次询问,每次询问给出一个位置x,yx,yx,y,求以x,yx,yx,y为左上角的B∗BB∗BB*B的子矩阵中的最大差值(最大值减最小值)是多少。 二维RMQ的模板题,和一维RMQ的...

sdxtcqs的博客 383

Cornfields POJ - 2019(二维rmq)

FJ has decided to grow his own corn hybrid in order to help the cows make the best possible milk. To that end, he’s looking to build the cornfield on the flattest piece of land he can find. FJ has, at great expense, surveyed his square farm of N x N hectar

tomjobs的博客 539

POJ - 2019 Cornfields(二维rmq)

题目链接:点击这里 题目大意: 给定一个 n×n(n≤250)n\times n(n\le 250)n×n(n≤250) 的方阵,以及 k(k≤105)k(k\le 10^5)k(k≤105) 个询问。 每次询问以 (xi,yi)(x_i,y_i)(xi​,yi​) 为左上角,边长为 bbb 的子方阵中,最大值和最小值的差 题目分析: 设 dp[i][j][k][o]dp[i][j][k][o]dp[i][j][k][o] 表示以 (i,j)(i,j)(i,j) 为左下角的点,横纵坐标跨度分别为 2k,2o

羊驼的博客 303

POJ2019 Cornfields 二维RMQ问题

二维RMQ问题 题意是输入

AC_Gibson的专栏 638

poj2019cornfields【二维RMQ】

本来想自己写来着,憋了半天没写明白,突然意识到这玩意我有邝斌的模板啊~·~WA了n发之后才发现自己错哪了,就不能细心点,唉,比赛可咋整 /*********** poj2019 2016.1.19 27388K 579MS C++ 1931B ***********/ #include #include #include #include #include using namespace st

MissZhou要努力 669

POJ 2019 Cornfields(二维RMQ)

Cornfields Time Limit:1000MS    Memory Limit:30000KB    64bit IO Format:%I64d & %I64u Description 给出一个N*N (N100000)个询问。每次询问如下:以(Xi,Yi)为左上角,边长为B的子方阵中,最大值和最小值的差是多少? 注意对于所有的询问,B都是一个定值。

每一次AC都是一种感动 553

Cornfields POJ - 2019(二维RMQ板题)

就是求子矩阵中最大值与最小值的差。。。 板子都套不对的人。。。。 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include &...

babing2770的博客 183

poj--2019Cornfields+二维RMQ问题

题目链接:点击进入 就是一个二维的RMQ问题,其实二维线段树或则是树状数组都是可以做的,但是二维的ST算法编码还是要简单一点。下面这份代码可以作为二维ST算法的模板用。代码如下:#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> using namespace std;int val[255

荒野孤鹰 940
上一篇: C++大数模版(转载)
下一篇: hdu 2609 How many(字符串的最小表示法)
KinFungYu
博客等级 码龄14年 39粉丝 400原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值