[codeforces 1364C] Ehab and Prefix MEXs MEX数据生成

DSI3协议介绍 分布式系统接口(DSI)是一种通用且功能强大的总线协议,旨在将多个遥感器和执行器设备互连到中央控制模块。该网络的主要目标应用是汽车安全系统。这种应用的一些特点是需要低成本、高鲁棒性、中速互连,仅限于两根导线。此外,它必须具有故障安全性、确定性和良好的EMC特性。即使具有所有级别的智能和可编程性的设备都可以连接到网络,远程设备也必须能够通过简单的状态机实现。由于模块尺寸非常重要,因此中央模块和远程单元中的最小组件至关重要。 阅读详情

Codeforces Round #649 (Div. 2)  参与排名人数11286

[codeforces 1364C]   Ehab and Prefix MEXs   MEX数据生成

总目录详见https://blog.csdn.net/mrcrack/article/details/103564004

在线测评地址https://codeforces.com/contest/1364/problem/C

ProblemLangVerdictTimeMemory
C - Ehab and Prefix MEXs GNU C++17Accepted62 ms1600 KB

题目大意:根据MEX({b1})=a1,MEX({b1,b2})=a2,MEX({b1,b2,b3})=a3,......

推导出数组b的各个元素,若不存在数组b,则输出-1.

第一步,明确,按题意,都能找到数组b.

第二步,因数组a是非递减序列,若a[i]!=a[i-1],则b[i]=a[i-1];

若a[i]==a[i-1],那么b[i]可以在[0,n]中未占用的数据中,自小到大,进行选取。

样例模拟如下

3
1 2 3

0 1 2 

在区间[0,3]未被占用的数是0
b[1]=0
因a[2]=2,a[1]=1,a[2]!=a[1],故a[1]=1可以腾出给b[2]使用
b[2]=1
因a[3]=3,a[2]=2,a[3]!=a[2],故a[2]=2可以腾出给b[3]使用
b[3]=2

故输出
0 1 2
4
0 0 0 2

1 3 4 0  

在区间[0,4]未被占用的数是1,3,4
b[1]=1
因a[2]=0,a[1]=0,a[2]==a[1],故自小到大使用未占用数3给b[2]使用
b[2]=3
因a[3]=0,a[2]=0,a[3]==a[2],故自小到大使用未占用数4给b[3]使用
b[3]=4
因a[4]=2,a[3]=0,a[4]!=a[3],故a[3]=0可以腾出给b[4]使用
b[4]=0

故输出
1 3 4 0
3
1 1 3

0 2 1   

在区间[0,3]未被占用的数是0,2
b[1]=0
因a[2]=1,a[1]=1,a[2]==a[1],故自小到大使用未占用数2给b[2]使用
b[2]=2
因a[3]=3,a[2]=1,a[3]!=a[2],故a[2]=1可以腾出给b[3]使用
b[3]=1

故输出
0 2 1

AC代码如下

#include <stdio.h>
#define maxn 100010
int a[maxn],vis[maxn],can[maxn],tot,b[maxn];
int main(){
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]),vis[a[i]]=1;
	for(i=n;i>=0;i--)
		if(!vis[i])can[++tot]=i;
	a[0]=a[1];
	for(i=1;i<=n;i++)
		if(a[i]!=a[i-1])b[i]=a[i-1];
		else b[i]=can[tot--];//a[i]==a[i-1];
	for(i=1;i<=n;i++)printf("%d ",b[i]);
	printf("\n");
	return 0;
}

类似题目

[codeforces 1294D] MEX maximizing 模是最终归宿

[codeforces 1325C] Ehab and Path-etic MEXs 绕不开的叶节点+特判

机器人控制基础:电机编码器常见类型 电机编码器是测量电机位置、速度和方向的传感器,主要分为光电、磁性和旋转变压器三类。光电编码器精度高但需防尘,适用于伺服系统;磁性编码器耐环境性强,常用于汽车电机;旋转变压器适应极端环境,多用于军工领域。按信号类型可分为增量式(成本低)和绝对式(断电保留位置)。选型需综合考虑精度、环境适应性及成本。 阅读详情

相关推荐

S4 Hana SD -信贷管理 - 03

自动信用控制将针对同一信用控制范围的不同的客户风险类别和信贷组执行不同的信用控制政策。对于ECC系统而言,无需单独设置检查规则,可在自动信贷控制进行设置即可,如图1-5-2。在S4 HANA版本中,自动信贷控制和检查规则是分离的。S4系统需要在定义自动信贷控制的时候,给字段“SAP信用管理”打钩,激活检查规则,然后需要单独在检查规则页签设置检查规则。接下来,我们分别介绍ECC和S4 HANA系统中两种不同配置方式.6.2SPRO。

weixin_46525734的博客 2894

C. Ehab and Prefix MEXs(ranting 1600)超详细题解

C. Ehab and Prefix MEXs(ranting 1600)超详细题解

Bill_HJR的博客 399

卷积神经网络-猫狗识别(附源码)

利用python实现一个卷积神经网络,训练猫狗数据集,实现对猫狗图片的预测识别

m0_63223213的博客 2万+

信息竞赛 OI比赛 造数据、测试数据 生成工具 汇总

信息竞赛 OI比赛 造数据、测试数据 生成工具 汇总

青少年趣味编程 7742

适配adv7280m相机到rk3588的安卓平台

Kernel-5.10/arch/arm64/configs/firefly_defconfig里面增加配置CONFIG_VIDEO_ADV7180=y。出现一次开不了机器的情况,接调试口发现,在set_fmt里面用s_ctrl对mipi的频率进行设置会出现异常。设备树修改kernel-5.10/arch/arm64/boot/dts/rockchip/13.dts。把MEDIA_ENT_F_ATV_DECODER改回MEDIA_ENT_F_CAM_SENSOR。第二次编译,仅仅刷新boot.img。

chenyq14的专栏 2450

RK3568平台开发系列讲解(UBOOT篇)u-boot启动流程

U-Boot(Universal Bootloader)是一种开源的引导加载程序,广泛用于嵌入式系统中。它的主要功能是初始化硬件设备,加载操作系统内核,并将控制权交给操作系统。U-Boot的启动流程可以分为多个阶段,以下是典型的U-Boot启动流程:

内核笔记 1241

codeforces 1364D Ehabs Last Corollary

题意:n个点的联通图,一定能找到小于k的环或(k+1)/2个互不相邻点 #include<bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, m, k; std::cin >> n >> m >> k; vector<vector<in.

best_jayc的博客 283

Linux 命令行的艺术

Linux 命令行的艺术前言基础日常使用文件及数据处理系统调试单行脚本冷门但有用仅限 OS X 系统仅限 Windows 系统更多资源免责声明熟练使用命令行是一种常常被忽视,或被认为难以掌握的技能,但实际上,它会提高你作为工程师的灵活性以及生产力。本文是一份我在 Linux 上工作时,发现的一些命令行使用技巧的摘要。有些技巧非常基础,而另一些则相当复杂,甚至晦涩难懂。这篇文章并不长,但当你能够熟练...

AI天才研究院 9286

使用python生成信息学奥赛题目测试数据

使用python生成信息学奥赛题目测试数据   python由于没有精度的限制(可以说是不存在高精的说法),所以可以方便快速的生成题目要求范围内的随机测试数据。而且不需要太深入的了解python的语法。 1.所使用到的模块 import random   注:random是python自带模块,它可以用来随机生成数据,不需要下载。 2.random模块中包含的主要函数函数 im...

小马的博客 4164

ArcGIS JSAPI 高级教程 - 添加多个 box 立方体 - 通过顶点、索引、UV 自定义每个 box、每个面不同颜色

ArcGIS JSAPI 高级教程 - 添加多个 box 立方体 - 通过顶点、索引、UV 自定义每个 box、每个面不同颜色。

非科班Java出身GISer的博客 405

YOLO26涨点改进| TGRS 2026 | 独家创新首发、注意力改进篇| 引入LCGA局部曲率引导注意力,保持局部稳定性的同时突出关键几何区域,含多种创新改进,促进YOLO26所有任务高效涨点

🔥本文提出LCGA(局部曲率引导注意力)模块,通过引入曲率信息改进YOLO26网络模型。LCGA在局部窗口内利用深度卷积构造曲率代理,调制标准窗口注意力,使模型更关注道路、边界等曲线型结构,提升遥感图像超分辨率中的几何保真度。相比普通注意力,LCGA能精准聚焦关键几何区域,减少边缘断裂和轮廓偏移,同时保持较低计算开销。实验表明LCGA显著提升性能,在UCMerced数据集上PSNR提升0.2148dB。文章提供了三种改进方案。

Ai缝合怪、助力小伙伴高效发论文 234

C. Ehab and Prefix MEXs

【代码】C. Ehab and Prefix MEXs。

yingxueyuhanling的博客 202

YOLO11优化:原创自研 | 低对比度场景 | 平滑的 CIoU,对其惩罚项(中心点距离和长宽比差异)进行平滑

为了应对上述挑战,我们需要一个对边界框定位误差更具容忍度的 IoU 变体。我们的核心思想是:在 CIoU 的基础上,对其惩罚项(中心点距离和长宽比差异)进行平滑处理

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 545

Ehab and Prefix MEXs CodeForces - 1364C(思维)

Given an array a of length n, find another array, b, of length n such that: for each i (1≤i≤n) MEX({b1, b2, …, bi})=ai. The MEX of a set of integers is the smallest non-negative integer that doesn’t belong to this set. If such array doesn’t exist, determin

starlet_kiss的博客 686

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

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

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

CodeForces - 1364C Ehab and Prefix MEX(贪心+构造)

题目链接:点击查看 题目大意:给出一个数组 a ,要求构造一个数组 b ,使得 a[ i ] = MEX{ b[ 1 ] , b[ 2 ] , ... b[ i - 1 ] , b[ i ] },a[ i ] 满足小于等于 i 题目分析:很巧妙的一道构造题目,首先通过观察不难发现,如果 a[ i ] != a[ i - 1 ] 的话,那么 b[ i ] = a[ i - 1 ] ,因为根据 MEX 前缀的性质,如果 MEX{ b[ 1 ] , b[ 2 ] , ... b[ i - 1 ] } = a[

Falcon的博客 788

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

C. Ehab and Prefix MEXs(构造)

第二行包含 n 个整数 a1, a2, ..., an (0≤ai≤i) - 数组 a 的元素。对于每个i(1≤i≤n)MEX({b1, b2, ..., bi})=ai。否则,打印包含n个整数b1,b2,...,bn(0≤bi≤106)的单行。给出一个长度为n的数组a,找到另一个长度为n的数组b,使得。第一行包含一个整数n(1≤n≤105)--数组a的长度。一组整数的MEX是不属于该组的最小的非负整数。如果没有这样的数组,打印一个包含-1的单行。如果这样的数组不存在,请确定这一点。

m0_64158084的博客 472

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

Codeforces Round #649 (Div.2)题解

文章目录A - XXXXXB - Most socially-distanced subsequenceC - Ehab and Prefix MEXs A - XXXXX 题意:这个题让你找从开头或者是结尾去掉最少几个数以后总和是不能整除给定的x 思路:如果这个序列总和可以整除给定的x的话,那么我们只要找到一个数可以不被x整除,把他从序列中取出,那么序列中剩余的总和也就不能被整除了。 分别从前从后开始搜索即可: /*Keep on going Never give up*/ #pragma GCC opt

xxxxxiao123的博客 3067

信息学奥赛noilinux下对拍程序c++

对拍就是你给两个程序和一个随机数据生成器,然后系统用随机数据生成器的输出数据作为你这两个程序的输入,比较这两个程序的输出,找到这两个程序输出不一样的一组数据。 data.exe是数据生成程序 test.exe是你需要检查的程序 AC.exe是正确的程序 这三个程序需要放在同一目录下,执行以下对拍程序即可   #include&lt;cstdio&gt; #include&lt;cstd...

wyjjqr的博客 1703

codeforces 1364 C

原题链接 题意 思路 1.根据题意可知,不可能输出-1 2.因数组a是非递减序列,若a[i] != a[i-1],则b[i] = a[i-1] ; 3.a[i]==a[i-1],那么b[i]可以在[0,n]中未占用的数据中,自小到大,进行选取。 AC代码 #include<bits/stdc++.h> using namespace std; const int N=1e6+10; int n; int a[N],b[N],vis[N],c[N],index; int main(

qq_44791484的博客 277

Codeforces 1364C

题意:通过数组a构建数组b;其中ai是MEX(b1~bi); 思路:假如两个数字不同那么第i号元素一定是i-1号元素; 假如相同的话;只需要从小到大一直添加即可; #include <iostream> #include <algorithm> #include <cstring> #include <map> #include <set> #include <vector> using namespace std; const int

qq_50298155的博客 189

Ehab and Prefix MEXs

题目连接: Ehab and Prefix MEXs 大致题意: 首先有个定义, 给定一个数组, MEX(i)表示数组前i项没有出现过的最小自然数. 要求就是给你一个数组a, 让你构建一个数组b, 要求对于b数组而言, MEX(i)的值为a[i]. 如果无法构建这样的数组, 输出-1; 解题思路: 首先可以分析一下输出-1的情况, 你发现题的数据卡的很严格, ai介于0与i之间, 并且ai还是非递减的. 你会发现所有输出-1的情况都因为这两个要求而不满足了, 所以本题一定有解. 我们观察样例1, 我们会发现

Fau的博客 435

CodeForces - 1364

CodeForces - 1364 A - XXXXX 1.如果总和不被x整除,则输出n 2.如果每个数都被x整除,则输出-1 3.找到最左端的不被x整除的数和最右端不被x整除的数 int t,n,x,a[maxn]; int main() { scanf("%d",&t); while(t--) { int l=INF,r=-1,sum=0; scanf("%d%d",&n,&x); rep(i,1,n)

想要一只银渐层 677

Codeforces 1325 C. Ehab and Path-etic MEXs (思维) /详解

C. Ehab and Path-etic MEXs time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output You are given a tree consisting of n nodes. You want to write some l...

放荡者的茶会 1303

C. Ehab and Prefix MEXs(模拟)

思路:首先判断是否有解,如果当前的a[i]>i,表示前面(i-1)个位置有i个数填好了,矛盾。之后,求解,先用集合将可能的选择存起来,如n=4,st=[0,1,2,3,4],然后扫一遍a[],把后序要出现的数预留好,也就是剔除一些当前位置不可以出现的数,stt=[0,0,0,2],st[1,3,4],当stt只剩下[2],表示0自由了,可以使用,加入到st。 int a[N]; int main() { //freopen("in.txt", "r", stdin); int n; scanf

qq_43543086的博客 627

cf:C. Ehab and Prefix MEXs

思路 吐槽自己:首先这是一道思维题,如果想出来的话,几行代码就搞定了,但是昨天晚上愣是1小时做出了,菜鸡一个,下面讲一下思路 做法: ①:我们先找一下规律,首先明确,如果要在b[i]位置放一个数字,那么这个数字必然不可能是a[i]~a[n]出现过的数,因为如果是的话,讨论到后面的某个j位置时候,会发现a[j]这个数被用过了,那MEX就不可能是a[j]了。 ②:那么我们就用一个set,把所有从i位置以后(包括i)没有在a中出现过的数字存下来,每一次必然从这个set中取出一个数字,存入b数组中,之后每次取出s

萌新的博客 344

C. Ehab and Path-etic MEXs

滴答滴答---题目链接 C. Ehab and Path-etic MEXs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a tree consisting ofnnno...

chen_zan_yu_的博客 354
上一篇: [codeforces 1364B] Most socially-distanced subsequence 绝对值脱壳的4种形态
下一篇: AtCoder Beginner Contest 170 A Five Variables 数组操作
mrcrack
博客等级 码龄15年 1072粉丝 1063原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值