Jzoj4845 寻找

第21期《Jzoj网站 9617: 回文素数》 题目描述: 时间限制: 1.000 Sec内存限制: 128 MB 提交: 55解决: 26 [命题人:][下载数据: 50] 提交状态报告 题目描述 回文素数定义:回文素数是一个既是素数又是回文数的整数。回文素数与记数系统的进位制有关。 回文素数是指,对一个整数n(n≥11)从左向右和从右向左读其结果值相同且是素数,即称n为回文素数。 最初几个回文素数:11,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929…… ... 阅读详情
“我有个愿望,我希望穿越一切找到你。”
这是个二维平面世界,平面上有n个特殊的果实,我从(0,0)点出发,希望得到尽量多的果实,但是出于某种特殊的原因,我的运动方式只有三种(假设当前我在(x,y)):
1、我可以走到(x+1,y)
2、我可以走到(x,y+1)
3、我可以走到(x+1,y+1)

现在我需要你的帮助,帮我找出我最多能够得到多少个果实。


经典的二维dp,我们设f[i][j]表示。。。

非常水的一维dp,我们将所有的点按照x排序让后做一次最长不下降子序列就好了

这里比较老实地用了离散化+数据结构,比二分好想多了。。。2333333

#pragma GCC optimize("O3")
#pragma G++ optimize("O3")
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define N 100010
#define mid (l+r>>1) 
using namespace std;
struct dt{ int x,y; } s[N];
int n,v[N],r[N],m,w[N<<2],f[N];
inline bool c1(dt a,dt b){ return a.x<b.x; }
void update(int l,int r,int x,int p,int k){
	if(l==r){ w[x]=max(w[x],k); return; }
	if(p<=mid) update(l,mid,x<<1,p,k);
	  else update(mid+1,r,x<<1|1,p,k);
	w[x]=max(w[x<<1],w[x<<1|1]);
}
int query(int l,int r,int x,int L,int R){
	if(L<=l && r<=R) return w[x];
	int Ans=0;
	if(L<=mid) Ans=max(Ans,query(l,mid,x<<1,L,R));
	if(mid<R) Ans=max(Ans,query(mid+1,r,x<<1|1,L,R));
	return Ans;
}
int main(){
	freopen("find.in","r",stdin);
	freopen("find.out","w",stdout);
	scanf("%d",&n);
	for(int x,y,i=1;i<=n;++i){
		scanf("%d%d",&x,&y);
		if(x<0 || y<0){ --n; --i; }
		else s[i]=(dt){x,y};
	}
	sort(s+1,s+1+n,c1);
	for(int i=1;i<=n;++i) v[i]=s[i].y;
	sort(v+1,v+1+n); m=unique(v+1,v+1+n)-v-1; 
	for(int i=1;i<=n;++i) r[i]=lower_bound(v+1,v+1+n,s[i].y)-v;
	for(int i=1;i<=n;++i){ f[i]=query(0,m,1,0,r[i])+1; update(0,m,1,r[i],f[i]); }
	printf("%d\n",w[1]);
}

openlayers6【十九】vue HeatmapLayer热力图层实现热力图效果详解 文章目录1. 写在前面2. Heatmap 类实现热力图2.1 Heatmap 参数2.2 实现热力图3. 完整代码4. 添加删除map图层的方法5. 热力图自身的get,set方法 1. 写在前面 我们主要看热力图的效果,区域绘制效怎么设置详细内容可以访问 openlayers6【十七】vue VectorLayer矢量图层画地图省市区,多省市区(粤港澳大湾区)效果详解 在 openlayers 中,图层是使用 layer 对象表示的,主要有 WebGLPoints Layer、热度图(HeatMap L 阅读详情

相关推荐

人工势场法在自动驾驶避障中的实践与优化

本文深入探讨了人工势场法在自动驾驶避障中的核心原理与实践优化。通过解析引力与斥力模型,揭示了经典算法在局部最优和目标不可达等问题上的局限性,并重点介绍了改进斥力场函数、引入道路边界斥力及动态参数调整等关键优化策略,有效提升了该局部路径规划算法在复杂动态场景下的实用性与鲁棒性。

weixin_29208327的博客 931

jzoj答案推荐

http://t.csdn.cn/HKxTb http://t.csdn.cn/FbU4b http://t.csdn.cn/ocZPN 这几个文章答案都不错

m0_72781649的博客 1334

STM32F103开发实战:如何用CubeMX+CLion调整Flash起始地址(附完整CMake配置)

本文详细介绍了在STM32F103开发中如何使用CubeMX和CLion工具链调整Flash起始地址,包括链接脚本修改、系统文件配置和CMake工程适配。通过实战步骤和完整配置示例,帮助开发者实现固件双备份、OTA升级等高级功能,提升嵌入式开发效率。

5b6n7m8的博客 213

jzoj5848

小 S 热爱大自然, 一天他种了一棵奇怪的线段树. 奇怪的线段树是一种与普通线段树类似的结构, 唯一不同的是, 它不一定以每一个区间的中点作为分治中心. 麻烦的是, 小 S 的线段树被风吹散了, 散成了一个个表示单一区间的结点, 而且正在逐渐飘远. 不过小 S 早有准备, 他可以进行抓取操作, 每一次他可以给出一个抓取区间, 由于这个抓取区间只有...

weixin_30906425的博客 186

Palantir解密:“本体”的建模逻辑及其扩展方向

上一篇重点从对现实世界建模的角度探讨了“本体”在数字化架构中的核心意义。这里借Palantir的“本体”概念、解析Palantir只是起点,目标旨在以他山之石攻玉——探索数字世界的底层架构逻辑,最终为构建自主体系提供思考。Palantir以“本体论”为核心的建模方案是否代表终极答案,不宜过早下结论,但其思路值得深入剖析。

SZSDQJC的博客 2644

手把手教你配置RK3588的FFmpeg+RKmpp:从解码到RGA转换的完整避坑指南

本文详细介绍了在RK3588平台上配置FFmpeg+RKmpp进行硬件解码和RGA图像处理的完整流程,包括环境准备、DRM Prime解码输出实战、RGA硬件加速转换技巧以及全链路性能调优。通过具体代码示例和问题排查指南,帮助开发者高效实现视频处理流水线,显著提升性能并降低CPU占用率。

weixin_28366475的博客 477

Jzoj 数字方阵部分代码(共30题)

1208: 【入门】数字走向I #include<bits/stdc++.h> using namespace std; int n, a[11][11], cnt=1; int main() { scanf("%d", &n); for(int i=1; i<=n; ++i){ for(int j=1; j<=n; ++j){ a[i][j]=cnt; cnt++; //场宽为3, 右对齐 printf("%3d", a[i][j]);

ypeijasd的专栏 3640

Android逆向实战:抖音聊天记录数据库解析与导出(附完整SQL查询)

本文提供了一份Android逆向实战指南,详细解析了抖音聊天记录数据库的结构与导出方法。通过定位核心的`im.db`数据库文件,深度解读conversation_list、msg等关键表结构,并附上完整的SQL查询语句,帮助开发者或研究人员安全、合规地提取和分析本地聊天数据,适用于移动安全研究与数据分析场景。

mango的博客 888

Jzoj 一维数组(包括排序)部分代码(共42题)

Jzoj 数组部分题目 1117: 【入门】数组逆序 2787: 【入门】统计 1635: 【入门】输出奇数和偶数 1113: 【入门】最大数 1125: 【入门】找找谁的身高超过全家的平均身高 1118: 【入门】数组元素的查找 1135: 【入门】查找支撑数 1120: 【入门】数组元素的移动 1121: 【入门】数组元素的插入 1122: 【入门】数组元素的删除 1119: 【入门】元素插入有序数组 1138: ......

ypeijasd的专栏 6704

v86.01 鸿蒙内核源码分析 (静态分配篇) | 很简单的一位小朋友 | 百篇博客分析 OpenHarmony 源码

相比动态分配,静态内存池的分配就是个小弟弟,非常的简单,两个结构体 + 一张图 就能说明白。

日拱一卒,力出一孔 776

使用AI预测彩票的架构思路

彩票是随机的数字游戏,不要过度依赖AI,本文仅供娱乐研究

14 年后端老兵,专注工程实战与银河麒麟信创运维。把每个真实生产事故,拆成能复现、能上线的保姆级教程。代码开源,评论区一起排错。 9435

【jzoj4845】【寻找】【线段树】

题目大意这是个二维平面世界,平面上有n个特殊的果实,我从(0,0)点出发,希望得到尽量多的果实,但是出于某种特殊的原因,我的运动方式只有三种(假设当前我在(x,y)):1、我可以走到(x+1,y)2、我可以走到(x,y+1)3、我可以走到(x+1,y+1)现在我需要你的帮助,帮我找出我最多能够得到多少个果实。解题思路先按x为第一关键字排序,y为第二关键字排序,显然一个点只能走到右上方,由于已经按x排

inklutcuah’s blog 517

手把手教你学SIMULINK模块库文件专栏--Scope 模块详解

模块是 Simulink 中的一个信号接收模块,用于实时显示信号波形。该模块可以捕捉并可视化仿真过程中信号的变化,帮助用户直观地分析系统的动态行为。模块都能提供强有力的支持。通过深入了解其参数的影响及结合 MATLAB 脚本的应用,读者可以更加有效地利用这一模块进行仿真和研究。此外,通过实际应用场景的扩展以及常见问题解答部分的帮助,能够更好地掌握。模块是一个非常实用的工具,适用于需要实时显示信号波形的各种场景。模块的参数,可以进一步增强学习体验。模块参数的影响,下面我们将详细探讨每个参数如何影响波形显示。

MHD0815的博客 316

【JZOJ4845】【NOIP2016提高A组集训第5场11.2】寻找

题目描述 “我有个愿望,我希望穿越一切找到你。” 这是个二维平面世界,平面上有n个特殊的果实,我从(0,0)点出发,希望得到尽量多的果实,但是出于某种特殊的原因,我的运动方式只有三种(假设当前我在(x,y)): 1、我可以走到(x+1,y) 2、我可以走到(x,y+1) 3、我可以走到(x+1,y+1) 现在我需要你的帮助,帮我找出我最多能够得到多少个果实。 数据...

weixin_30734435的博客 171

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

JZOJ 4845 【NOIP2016提高A组集训第5场11.2】寻找

寻找题目描述在平面直角坐标系上有NN个果实,每个果实都有一个对应的坐标,现在YYKYYK从原点(00,00)出发,由于YYKYYK是一种很奇怪的生物,所以她的运动方式只有三种(假设当前YYKYYK在(xx,yy)) 1、YYKYYK可以走到(xx+11,yy) 2、它 可以走到(xx,yy+11) 3、她可以走到(xx+11,yy+11) YYKYYK很贪心,她想拿尽量多的果实,但她又比较蠢

XianHaoMing的博客 1975

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jzoj 1002 1020 1054 for循环类

jzoj 1002 1020 1054 for循环类

hfy1234512345的博客 402

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

好用的编程Online Judge网页分享

这是四个我认为比较好的C++Online Judge的网页,给大家分享一下。首页 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)OpenJudge - NOI - 首页。

zjy_goldfish的博客 1630

[JZOJ5427]吃草

问题描述后院总共有n片草坪,第i片草坪投影到数轴上,是一段l[i]到r[i]的闭区间,保证l[i]+r[i]是偶数,l[i]<=r[i]。 Sullivan可以在整点上放0v0来把草吃掉(于是0v0变成了0π0)。如果第i片草坪覆盖了x点上的0π0(l[i]<=x<=r[i]),那么这只0π0就可以吃掉这片草坪里的草。每一片草坪的草需要且只能被一只0π0吃掉。如果一片草坪覆盖了多只0π0,Sull

ZLTJohn的博客 725

高精度加、减、乘、除(高精除以低精)、除(高精除以高精)

#include <bits/stdc++.h> using namespace std; char s1[510], s2[510]; int a[510], b[510], sum[510]; int lena, lenb, lens; int main() { cin >> s1 >> s2; lena=strlen(s1); lenb=strlen(s2); lens=max(lena, lenb); for(int i=1; i<=lena.

ypeijasd的专栏 589

jzoj【NOIP2017提高A组冲刺11.2】失格

题目Time Limits: 7000 ms Memory Limits: 786432 KB Description胆小鬼连幸福都会害怕,碰到棉花都会受伤,有时还被幸福所伤。 ——太宰治《人间失格》回顾我的一生,一共有n个事件,每一个事件有一个幸福值p_i。 我想用n-1条线把所有的事件连起来,变成一个连通块。一条连接了事件x和事件y的线会产生min(p_x mod p_y,p_y mod

Marcus 986

4845. 【NOIP2016提高A组集训第5场11.2】寻找

Description“我有个愿望,我希望穿越一切找到你。” 这是个二维平面世界,平面上有n个特殊的果实,我从(0,0)点出发,希望得到尽量多的果实,但是出于某种特殊的原因,我的运动方式只有三种(假设当前我在(x,y)): 1、我可以走到(x+1,y) 2、我可以走到(x,y+1) 3、我可以走到(x+1,y+1) 现在我需要你的帮助,帮我找出我最多能够得到多少个果实。Data Const

dance in th dark的博客 600

【NOIP2016提高A组集训第5场11.2】寻找

Description“我有个愿望,我希望穿越一切找到你。” 这是个二维平面世界,平面上有n个特殊的果实,我从(0,0)点出发,希望得到尽量多的果实,但是出于某种特殊的原因,我的运动方式只有三种(假设当前我在(x,y)): 1、我可以走到(x+1,y) 2、我可以走到(x,y+1) 3、我可以走到(x+1,y+1) 现在我需要你的帮助,帮我找出我最多能够得到多少个果实。Input第一行一个

Marcus 466
上一篇: Jzoj4838 I like Matrix!
下一篇: Jzoj4846 行走
扩展的灰
博客等级 码龄12年 60粉丝 342原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址