[tyvj1730二逼平衡树]解题报告

LCT学习笔记 一、什么是势能分析? 势能分析首先要有一个势能函数F(S),S是一个数据结构集合,是你要分析的所有数据结构的集合,比如说你要分析一坨splay/lct森林的时间复杂度,那么f就是splay/lct森林的势能函数,而不仅仅是一棵splay/lct,虽然它也可以是。 对于每一次操作,我们进行这样的放缩:实际运行代价+势能改变量 ≤G(n)(n=|S|)。G(n)是一个比较良性的函数。那么我们把所有操 阅读详情

学了一下主席树,由于怕调不出来,选择了用普通线段树套权值线段树。

犯得一些傻逼错误是:

①把大小写n混用结果弄错了。

②没过样例TM就交了。

③被题意坑了,“保证有序序列所有值在任何时刻满足[0,10^8]",并不意味着询问非负。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#include<iostream>
char * p=(char *)malloc(5000000);
inline int in(){
	int x=0;
	bool flag=0;
	while(*p<'0'||*p>'9')flag|=*p++=='-';
	while(*p>='0'&&*p<='9')x=x*10+*p++-'0';
	return flag?-x:x;
}
char buf[500000],* ptr=buf,tmp[10];
inline void out(int x){
	int tot=0;
	for(;x;x/=10)tmp[tot++]=x%10+'0';
	if(tot==0)*ptr++='0';
	else while(tot--)*ptr++=tmp[tot];
	*ptr++='\n';
}
 
int seq[50001],a[100001],N;
struct TS{
	int size,max,min;
	TS * c[2];
}root[200000],treepool[13000000],* list[40];
#define lson node<<1,l,(l+r)>>1
#define rson node<<1|1,((l+r)>>1)+1,r
int treetop=1,listtop;
int l[50000],r[50000],k[50000],opt[50000];
 
inline void add(TS * node,int l,int r,int A,int delta){
	node->size+=delta;
	if(l!=r){
		if(A>(l+r)>>1){
			if(node->c[1]==treepool){
				node->c[1]=treepool+treetop;
				treepool[treetop].c[0]=treepool[treetop].c[1]=treepool;
				treepool[treetop].max=-1,treepool[treetop].min=0x7fffffff;
				++treetop;
			}
			add(node->c[1],((l+r)>>1)+1,r,A,delta);
		}
		else{
			if(node->c[0]==treepool){
				node->c[0]=treepool+treetop;
				treepool[treetop].c[0]=treepool[treetop].c[1]=treepool;
				treepool[treetop].max=-1,treepool[treetop].min=0x7fffffff;
				++treetop;
			}
			add(node->c[0],l,(l+r)>>1,A,delta);
		}
		node->max=max(node->c[0]->max,node->c[1]->max);
		node->min=min(node->c[0]->min,node->c[1]->min);
	}
	else if(node->size)node->max=node->min=l;
	else node->max=-1,node->min=0x7fffffff;
}
inline int sum(TS * node,int l,int r,int A){
	if(l>=A||node->size==0)return 0;
	if(r<A)return node->size;
	return sum(node->c[0],l,(l+r)>>1,A)+sum(node->c[1],((l+r)>>1)+1,r,A);
}
inline int qk(int k){
	int suml,sumr,i,l=0,r=N-1;
	while(l!=r){
		suml=0,sumr=0;
		for(i=listtop;i--;)suml+=list[i]->c[0]->size,sumr+=list[i]->c[1]->size;
		if(suml>=k){
			for(i=listtop;i--;)list[i]=list[i]->c[0];
			r=(l+r)>>1;
		}
		else{
			for(i=listtop;i--;)list[i]=list[i]->c[1];
			l=((l+r)>>1)+1;
			k-=suml;
		}
	}
	return l;
}
inline int pred(TS * node,int l,int r,int A){
	if(l>=A||node->size==0)return -1;
	if(r<A)return node->max;
	return max(pred(node->c[0],l,(l+r)>>1,A),pred(node->c[1],((l+r)>>1)+1,r,A));
}
inline int succ(TS * node,int l,int r,int A){
	if(r<A||node->size==0)return 0x7fffffff;
	if(l>=A)return node->min;
	return min(succ(node->c[0],l,(l+r)>>1,A),succ(node->c[1],((l+r)>>1)+1,r,A));
}
 
 
inline void build(int node,int l,int r){
	if(l!=r)build(lson),build(rson);
	for(;l<=r;++l)add(root+node,0,N-1,seq[l],1);
}
inline int sum(int node,int l,int r,int L,int R,int A){
	if(l>R||r<L)return 0;
	if(L<=l&&r<=R)return sum(root+node,0,N-1,A);
	return sum(lson,L,R,A)+sum(rson,L,R,A);
}
inline void get(int node,int l,int r,int L,int R){
	if(L<=l&&r<=R){
		list[listtop++]=root+node;
		return;
	}
	if(R>(l+r)>>1)get(rson,L,R);
	if(L<=(l+r)>>1)get(lson,L,R);
}
inline void del(int node,int l,int r,int A){
	add(root+node,0,N-1,seq[A],-1);
	if(A>(l+r)>>1)del(rson,A);
	else if(l!=r)del(lson,A);
}
inline void add(int node,int l,int r,int A,int k){
	add(root+node,0,N-1,k,1);
	if(A>(l+r)>>1)add(rson,A,k);
	else if(l!=r)add(lson,A,k);
}
inline int pred(int node,int l,int r,int L,int R,int A){
	if(l>R||r<L)return -1;
	if(L<=l&&r<=R)return pred(root+node,0,N-1,A);
	return max(pred(lson,L,R,A),pred(rson,L,R,A));
}
inline int succ(int node,int l,int r,int L,int R,int A){
	if(l>R||r<L)return 0x7fffffff;
	if(L<=l&&r<=R)return succ(root+node,0,N-1,A);
	return min(succ(lson,L,R,A),succ(rson,L,R,A));
}
int main(){
	freopen("psh.in","r",stdin);
	freopen("psh.out","w",stdout);
	fread(p,1,5000000,stdin);
	int n=in(),m=in(),i,j;
	//Read,Sort,and Hash.
	for(i=1;i<=n;++i)seq[i]=in(),a[i-1]=seq[i];
	N=n;
	for(i=0;i<m;++i){
		opt[i]=in(),l[i]=in();
		if(opt[i]!=3)r[i]=in();
		k[i]=in();
		if(opt[i]==3)a[N++]=k[i];
	}
	sort(a,a+N);
	N=unique(a,a+N)-a;
	for(i=1;i<=n;++i)seq[i]=lower_bound(a,a+N,seq[i])-a;
	treepool->max=-1,treepool->min=0x7fffffff,treepool->c[0]=treepool->c[1]=treepool;
	for(i=0;i<200000;++i)root[i].max=-1,root[i].min=0x7fffffff,root[i].c[0]=root[i].c[1]=treepool;
	build(1,1,n);
	for(i=0;i<m;++i)
		switch(opt[i]){
			case 1:
				k[i]=lower_bound(a,a+N,k[i])-a;
				if(k[i])out(sum(1,1,n,l[i],r[i],k[i])+1);
				else out(1);
				break;
			case 2:
				listtop=0;
				get(1,1,n,l[i],r[i]);
				out(a[qk(k[i])]);
				break;
			case 3:
				k[i]=lower_bound(a,a+N,k[i])-a;
				del(1,1,n,l[i]);
				add(1,1,n,l[i],k[i]);
				seq[l[i]]=k[i];
				break;
			case 4:
				out(a[pred(1,1,n,l[i],r[i],lower_bound(a,a+N,k[i])-a)]);//<A
				break;
			case 5:
				out(a[succ(1,1,n,l[i],r[i],upper_bound(a,a+N,k[i])-a)]);//>=A
				break;
		}
	fwrite(buf,1,ptr-buf,stdout);
}


[NOI1999]内存分配 解题报告 [NOI1999] 内存分配 时间限制:1 s 内存限制:128 MB 内存是计算机重要的资源之一,程序运行的过程中必须对内存进行分配。 经典的内存分配过程是这样进行的: 内存以内存单元为基本单位,每个内存单元用一个固定的整数作为标识,称为地址。地址从0开始连续排列,地址相邻的内存单元被认为是逻辑上连续的。我们把从地址i开始的s个连续的内存单元称为首地址为i长度为s的地址片。 运行过程中有若干进程需要占用内存,对于每个进程有一个申请时刻T,需要内存单元数M及运行时间P。在运行时间P内(即T时刻开始,T+ 阅读详情

相关推荐

[Apio2009]CONVENTION会议中心 解题报告

这题并不会做。。 这道题的主要问题是如何求一个区间的最大不相交线段覆盖,思路是可以用倍增来加速贪心。就是说我们本来是求一个区间里最多有多少条线段,我们把它转换成二分/倍增线段数,求其最短的区间是多少。 代码:#include<cstdio> #include<iostream> using namespace std; #include<algorithm> #include<cstring>

TA 2476

Tyvj 1730 二逼平衡树 (树套树裸题)

题目链接 Description 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 1.查询k在区间内的排名 2.查询区间内排名为k的值 3.修改某一位值上的数值 4.查询k在区间内的前驱(前驱定义为小于x,且最大的数) 5.查询k在区间内的后继(后继定义为大于x,且最小的数) Input 第一行两个数 n,m 表示长度为n的有序

换个姿势,再敲一次 838

毫米波雷达IWR1843开箱演示

毫米波雷达IWR1843开箱演示

m0_56120826的博客 7801

BZOJ 3196: Tyvj 1730 二逼平衡树 树套树

3196: Tyvj 1730 二逼平衡树 Time Limit: 10 Sec  Memory Limit: 128 MB Submit: 3991  Solved: 1542 [Submit][Status][Discuss] Description 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 1.查询k在区间内的排名 2.查询区间内排

BlackJack 534

ESP32对接百度智能云语音识别:从硬件配置到API调用的完整指南

本文详细介绍了ESP32对接百度智能云语音识别的完整流程,从硬件配置到API调用,涵盖麦克风选择、音频处理、错误处理及性能优化等关键环节。通过实战案例展示如何实现低成本、高效率的语音交互方案,特别适合智能硬件开发者参考。

weixin_29198045的博客 376

英飞凌 AURIX Development Studio工程移植到Hightec的方法

1. 软件简介 AURIX™ Development Studio是英飞凌针对AURIX TC2XX/TC3XX系列单片机推出了一款免费的软件,集成了iLLD库,内置Tasking compiler和Tasking Debugger,但这两个模块只能用于非商业用途,可供学习和试用。iLLD库是英飞凌为TC2XX和TC3XX Tricore系列单片机提供的底层驱动库,有完善的使用手册,和较好的移植性。 Hightec是一款可以用来开发Aurix系列单片机的编译器,有免费版,可商用,集成GCC编译器,可用UDE

weixin_42967006的博客 7144

[BZOJ3196]Tyvj 1730 二逼平衡树

树套树 树状数组套线段树

srand(time(0)) 519

S7-200 Smart 控制运动轴(脉冲电机/伺服)教程

S7-200 Smart 控制运动轴(脉冲电机/伺服) 结合本人刚接触触摸屏时候的踩坑经验,编写S7-200 Smart 控制运动轴(脉冲电机/伺服)的详细流程,给刚接触PLC的朋友提供一些经验指导。 本文详细介绍了S7-200 Smart 控制脉冲步进/伺服电机流程,包含接线方法及梯形图。希望对初学者有所帮助

xjbsw0的博客 5万+

[TYVJ1730]二逼平衡树解题报告

【题目描述】 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 1.查询k在区间内的排名 2.查询区间内排名为k的值 3.修改某一位值上的数值 4.查询k在区间内的前驱(前驱定义为小于x,且最大的数) 5.查询k在区间内的后继(后继定义为大于x,且最小的数) 【输入格式】 第一行两个数 n,m 表示长度为n的有序序列和m个操作 第二行

Ostmbh的博客 522

555时基芯片的5种经典电路设计:从方波发生器到PWM调光实战

本文深入解析了555时基芯片的5种经典电路设计,从基础的无稳态方波发生器、单稳态触发器,到实用的占空比可调PWM信号源,并重点介绍了如何引入TVS保护电路增强系统鲁棒性。最后通过一个带保护的PWM LED调光台灯实战项目,综合展示了信号生成、功率驱动与电路保护的核心技术,是电子爱好者掌握模拟电路设计与应用的绝佳指南。

weixin_29207439的博客 501

wsl2内核版本和模块版本不一致解决方法

** /lib/modules/…build: No such file or directory错误解决办法这篇文章历时1个月整,从4月5日一直到5月5日,这一问题才得以解决。

m0_60634555的博客 5110

[TYVJ1730]二逼平衡树

[TYVJ1730]二逼平衡树 题目 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:1.查询k在区间内的排名2.查询区间内排名为k的值3.修改某一位值上的数值4.查询k在区间内的前驱(前驱定义为小于x,且最大的数)5.查询k在区间内的后继(后继定义为大于x,且最小的数) INPUT 第一行两个数 n,m 表示长度为n的有序序列和m个操作第二...

weixin_30279315的博客 99

EGO_Planner代码学习(三):px4ctrl代码流程

上节阅读了EGO_Planner的轨迹服务器部分的代码,其实质是将规划器生成的轨迹进行离散化,间隔10ms计算当前时刻在轨迹上的位置,并发送到话题上。这两天抽空看了下控制器部分的代码,在l这个软件包里,它的功能是进行px4的模式识别和上层控制,通过线性控制器把发布过来的位置命令解算成飞控的控制量,通过mavros发送给px4。下面就详细看一下它的启动过程。

qq_41069236的博客 6813

洛谷 P3380 【模板】二逼平衡树(树套树)-线段树套splay

P3380 【模板】二逼平衡树(树套树) 题目描述 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 查询k在区间内的排名 查询区间内排名为k的值 修改某一位值上的数值 查询k在区间内的前驱(前驱定义为严格小于x,且最大的数,若不存在输出-2147483647) 查询k在区间内的后继(后继定义为严格大于x,且最...

weixin_30496751的博客 167

Weka学习笔记01:初探Weka世界

下载、安装和启动Weka、Weka数据格式

howard2005的专栏 1481

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

HYSBZ3196-Tyvj 1730 二逼平衡树

Tyvj 1730 二逼平衡树 Time Limit: 10 Sec  Memory Limit: 128 MB Submit: 4293  Solved: 1652 [Submit][Status][Discuss] Description 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 1.查询k在区间内的排名 2.查询区间内排名为k的值

wang_128的博客 420

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

洛谷P3380 【模板】二逼平衡树(树套树)

题目描述 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 查询k在区间内的排名 查询区间内排名为k的值 修改某一位值上的数值 查询k在区间内的前驱(前驱定义为严格小于x,且最大的数,若不存在输出-2147483647) 查询k在区间内的后继(后继定义为严格大于x,且最小的数,若不存在输出2147483647) ...

whisperlzw的博客 324

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

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

深度学习工具包 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")

BZOJ3196: Tyvj 1730 二逼平衡树(树套树)

Description 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:1.查询k在区间内的排名2.查询区间内排名为k的值3.修改某一位值上的数值4.查询k在区间内的前驱(前驱定义为小于x,且最大的数)5.查询k在区间内的后继(后继定义为大于x,且最小的数) Input 第一行两个数 n,m 表示长度为n的有序序列和m个操作第二行有n个数...

weixin_30451709的博客 185

二逼平衡树(树套树)

树套树编程技巧。 1.tmp,这个答案的中间变量,便于解题。 2.用splay结构体来写树套树。   #include #include #include #include #include using namespace std; const int N=60005; const int inf=0x3f3f3f3f; int n,m,tmp; int c[N];

zhhx2001的博客 722

[Luogu P3380] [BZOJ 3196]【模板】二逼平衡树(树套树)

洛谷传送门(数据水) BZOJ传送门 题目描述(洛谷) 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作: 查询k在区间内的排名 查询区间内排名为k的值 修改某一位值上的数值 查询k在区间内的前驱(前驱定义为严格小于x,且最大的数,若不存在输出-2147483647) 查询k在区间内的后继(后继定义为严格大于x,且最小的数,若不存在输出21474836...

LPA的博客 344

bzoj 乱刷计划 50/50

前言 话说第一个板刷计划由于种种原因而告一段落了。。其实那一版还有很多题想做,那就只能放一放了 附上效果图一张(几乎每一题都在我博客有题解): 打算 可以复习,重做自己做过的题,不局限于没做过的 乱刷计划 3223: Tyvj 1729 文艺平衡树 这题的话是一个Splay的裸题 并且只需要支持翻转操作 至于怎么找到区间,你就找到第l-1个,和第r+1个 把前者

OZY的博客 1088

借教室[NOIP2012]解题报告

思路一:O(mlogn)           裸的线段树,维护最小值和区间修改;由于是第一次写线段树,所以不太会写。 代码:  #include using namespace std; #include #include #include #include char * ptr=new char[50000000]; int tree[2500000],lazy[250000

TA 2408

[NOI2010]超级钢琴 解题报告

超级钢琴 【问题描述】 小Z是一个小有名气的钢琴家,最近C博士送给了小Z一架超级钢琴,小Z希望能够用这架钢琴创作出世界上最美妙的音乐。 这架超级钢琴可以弹奏出n个音符,编号为1至n。第i个音符的美妙度为Ai,其中Ai可正可负。 一个“超级和弦”由若干个编号连续的音符组成,包含的音符个数不少于L且不多于R。我们定义超级和弦的美妙度为其包含的所有音符的美妙度之和。两个超级和弦被认为是相同的

TA 2093

SDOI2015游记

Day1 今天的遗憾主要在于T1,没有想到2个块里可能会有两种不等价的交换,其实这种计数问题,应该要想到会有不等价的情况的。。但是我还是没想到,导致白丢了15分。 但是反过来想,其实即使我想到了不等价的情况,实际上我也觉得我搞不出正解的,我并没有想到可以用搜索来解决这个问题,虽然它在知道题解之后看起来很显然了。 那么,作为总结的话,是要告诉自己以后该怎么避免这种情况的发生。

TA 2039
上一篇: [SDOI2010星际竞速]解题报告
下一篇: [CF231DPhysical Education and Buns]解题报告
TA201314
博客等级 码龄12年 81粉丝 187原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值