Greatest Common Increasing Subsequence【 HDU - 1423 】

最新扣子(coze)案例:在coze上用DeepSeek+私有数据库、知识库,创建你的专属智能体 Gartner预测,到2026年,70%的企业将通过Al知识库实现「组织记忆外化」。数字化时代,数据已成为企业发展的核心资产。我们通过人工智能将知识库从“静态存储"升级为“智能服务”。让"沉睡宝藏"焕发新生,助力企业突破数据困局。 阅读详情

This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.

Input

Each sequence is described with M - its length (1 <= M <= 500) and M integer numbers Ai (-2^31 <= Ai < 2^31) - the sequence itself.

Output

output print L - the length of the greatest common increasing subsequence of both sequences.

Sample Input

1

5
1 4 2 5 -12
4
-12 1 2 4

Sample Output

2

题意:

这是一道典型的求最长公共子序列问题。

求出两个数组公共的最长的上升子序列(可以不是连续的子序列)。

代码:

#include<stdio.h>
#include<string.h>

int t,l1,l2,k;
int s1[510], s2[510];
int dp[510];

int song()
{
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= l1; ++i)
    {
        k = 0;
        for (int j = 1; j <= l2; ++j)
        {
            if (s1[i] > s2[j] && k < dp[j])
                k = dp[j];
                
            if (s1[i] == s2[j])
                dp[j] = k+ 1;
        }
    }
    k = 0;
    for (int i = 1; i <= l2; ++i)
    {
        if (k < dp[i])
            k = dp[i];
    }
    return k;
}

int main()
{
    scanf("%d", &t);
    while (t--)
    {
        scanf("%d", &l1);
        for (int i = 1; i <= l1; ++i)
            scanf("%d", &s1[i]);

        scanf("%d", &l2);
        for (int i = 1; i <= l2; ++i)
            scanf("%d", &s2[i]);

        printf("%d\n", song());
        if (t)
            putchar('\n');
    }
    return 0;
}

 

Unity中5自由度机械臂运动控制与夹爪交互仿真实践 本文详细介绍了在Unity中实现5自由度机械臂运动控制与夹爪交互仿真的完整流程。从模型导入、物理组件配置到关节运动控制算法(包括逆运动学IK),再到夹爪抓取逻辑和工业分拣案例实战,提供了可落地的代码示例与性能优化方案,助力开发者快速掌握机械臂仿真核心技术。 阅读详情

相关推荐

某银行大数据分析平台之云原生架构

软考架构师论文

doudoudouy的博客 768

poj2127 Greatest Common Increasing Subsequence

线性dp

YHaX的博客 536

C#实战:基于ONNX与SCRFD/ArcFace的高效人脸识别系统开发

本文详细介绍了如何在C#环境中,利用ONNX Runtime高效部署SCRFD人脸检测与ArcFace人脸识别模型,构建一个完整的、高性能的人脸识别系统。内容涵盖环境搭建、模型推理、人脸对齐、特征提取等核心模块,并提供了从Demo到生产系统的优化思路与实战代码,为.NET开发者提供了一套开箱即用的解决方案。

weixin_29061821的博客 488

hdu1423Greatest Common Increasing Subsequence(最长公共递增子序列)

Greatest Common Increasing Subsequence Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 10   Accepted Submission(s) : 3 Problem Descripti

495

用Python玩转农业大数据:从Landsat遥感影像到作物产量预测实战教程

本文详细介绍了如何利用Python处理Landsat遥感影像数据,并结合土壤信息构建作物产量预测模型。从环境搭建、数据预处理到模型训练与可视化,提供了一套完整的农业大数据分析实战方案,帮助读者掌握遥感影像处理和机器学习在精准农业中的应用。

weixin_30832143的博客 398

STM32G070xx将Flash页分块方式存储,固定数据块存储,实现一次擦除多次写入

本例程使用STM32G070xx芯片,Flash大小128KB,Flash每页(2048字节)写满后再擦除。操作存储区分为64块,每块32字节,即写满64次擦除一次;标定存储区分为16块,每块128字节,即写满16次擦除一次,每个存储区的块都有各自的头部标记

RaphaelCeo的博客 1545

hdoj1423Greatest Common Increasing Subsequence【LCIS】

Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6035    Accepted Submission(s): 1963 Problem De

走一步再走一步 502

具身智能(40):主流 VLA 模型π₀

摘要: π₀是首款专为机器人设计的VLA(视觉-语言-动作)端到端基础模型,通过双阶段训练实现“感知-决策-执行”闭环。其创新点包括:1)FlowMatching技术实现连续平滑动作控制(精度0.3°);2)结合VLM预训练与多机器人实操数据,零样本任务完成率达76.4%,远超同类模型;3)支持模糊指令理解与动态场景适应(如遮挡识别)。开源版本涵盖不同规模模型,适用于工业装配、服务机器人等场景,在延迟(213ms)和稳定性(92%自主恢复率)上显著领先OpenVLA等竞品。

码农17年的博客 511

hdu1423 Greatest Common Increasing Subsequence 最长公共上升子序列 模板题

Greatest Common Increasing SubsequenceTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9049    Accepted Submission(s): 2912Problem DescriptionThi...

popcjz的博客 304

手把手教你学PCIE(9.3)--pcie常见故障及原因:配置错误介绍

PCIe 设备的配置错误可能涉及操作系统设置、BIOS 设置、驱动程序设置和配置文件设置等多个方面。通过以上方法,可以有效地诊断和解决 PCIe 设备的配置错误。

MHD0815的博客 2439

【26美赛D题】2026美赛数学建模(MCM/ICM)思路解析及代码分享

2026美赛D题数学建模竞赛思路解析摘要:本文针对美赛D题提供系统性解决方案,提出四层建模框架(数据层、机理层、模型层、决策层),强调逻辑闭环比模型复杂度更重要。包含通用建模步骤:指标体系构建、状态评估、动态预测和策略优化,并给出Python基础代码框架。论文建议采用七段式结构,突出从现实问题到决策方案的完整闭环。核心在于通过数据驱动方法揭示问题规律,结合多源数据整合、系统行为建模和风险评估,最终形成可落地的决策建议,体现数学建模解决实际问题的能力。

一键难忘的博客 1083

HDU 1423 Greatest Common Increasing Subsequence(最长公共子序列+最长不下降子序列)

Greatest Common Increasing Subsequence Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 6   Accepted Submission(s) : 1 Font: Times New R

Coldplay 1378

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

HDU1423:Greatest Common Increasing Subsequence

点击打开题目链接 Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3074    Accepted Submission(s): 966

I just want to AC you~~~ 1105

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

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

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

hdu 1423 Greatest Common Increasing Subsequence 最长公共上升子序列

hdu 1423 Greatest Common Increasing Subsequence http://acm.hdu.edu.cn/showproblem.php?pid=1423 #include #include #include #include using namespace std; int ch1[1110], ch2[1110], dp[1110], len1,

倩 516

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

hdu 1423 Greatest Common Increasing Subsequence 最大公共上升子序列 DP

Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence. Input Each sequence is described with M - its length (1 <= M <= 500) and M integer numbers Ai (-2^31 <= Ai < 2^31) - the sequence i

Lionel 955

HDU 1423 —— Greatest Common Increasing Subsequence

原题:http://acm.hdu.edu.cn/showproblem.php?pid=1423 题意:求最长上升公共子序列的个数; 注意:每组数据之间要空一行,最后一组数据结束不需要空行; #include #include #include #include using namespace std; const int maxn = 510; int cas, n, m; in

0x3f3f3f3f 448

HDU 1423 Greatest Common Increasing Subsequence

 http://acm.hdu.edu.cn/showproblem.php?pid=1423 题目大意:就是叫你求最长公共递增子序列的长度。So就用LCIS算法做了。 #include #include const int size = 505;int a[size],b[size];int len[size];/*b字符串到第j个字符时,该字符位置处的公

话别深秋 2515

hdu1423---Greatest Common Increasing Subsequence

Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.Input Each sequence is described with M - its length (1 <= M <= 500) and M int

Alex 1216

HDU1423-Greatest Common Increasing Subsequence

Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence. Input Each sequence is described with M - its length (1...

weixin_30261095的博客 182

HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS)

HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS) http://acm.hdu.edu.cn/showproblem.php?pid=1423 题意:        给你两个数字组成的串a和b,要你求出它们的最长公共严格递增子序列的长度(LCIS). 分析:        首先我们令f[i][j]==x表示是a...

weixin_34221773的博客 97

hdu 1423 Greatest Common Increasing Subsequence

Greatest Common Increasing Subsequence hdu 1423 GCIS (n^2) 省赛的时候,这个题目看了良久,都没想到O(n^2)的算法。后来苏犇看到GCIS的时候就让看模版,然后在吉大的模版上看到了这个 然后我们就顺利的1Y.我又看了一下这个题目,找了好多博客(不是挂了,就是讲的很不清楚)。。然后看到了http://www.tyvj.cn/bb

BootStar 531

HDU1423:Greatest Common Increasing Subsequence

浅谈\(DP\):https://www.cnblogs.com/AKMer/p/10437525.html 题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1423 最长上升子序列:https://www.cnblogs.com/AKMer/p/10437536.html 最长公共子序列:https://www.cnblogs.com/A...

aga28832的博客 119

【hdu1423】Greatest Common Increasing Subsequence dp

题意 给定两个序列,求其lcis 题解 我们用f[i][j]表示在a[1~i]中和b[1~j]中以b[j]结尾的lcis 每次转移 1 如果a[i]!=b[j] 那么就是这个更新的a[i]没啥子鸟用,f[i][j]=f[i-1][j]。 2 如果a[i]==b[j],那么我就要从j之前的序列b中选一个比b[j]小的k,每次比较一下 f[i][j]与f[i-1][k]+1进行替换 但这样做的话我们发...

Mininda 386

HDU1423 Greatest Common Increasing Subsequence【最长公共子上升序列 +DP】

Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11284 Accepted Submission(s): 3638 Problem Descriptio...

海岛Blog 705
上一篇: Largest Rectangle in a Histogram 【HDU - 1506 】
下一篇: FatMouse's Speed 【HDU - 1160】
Daisy's一乐景三
博客等级 码龄8年 2粉丝 56原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值