牛客OI赛制测试赛E的旅行青蛙模式是怎样的?

2026-06-09 11:191阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计205个文字,预计阅读时间需要1分钟。

牛客OI赛制测试赛E的旅行青蛙模式是怎样的?

项目名称:门牌序列生成器

功能描述:生成一系列门牌号码,门牌号码以递增方式排列。

牛客OI赛制测试赛E的旅行青蛙模式是怎样的?

最长递减子序列:[999, 998, 997, ..., 3, 2, 1]

代码示例:pythondef generate_door_number_sequence(start, end): return list(range(start, end + 1))

生成1到100的门牌号码序列door_number_sequence=generate_door_number_sequence(1, 100)print(door_number_sequence)


​​题目传送门​​​ 最长不下降子序列
代码:

#include<bits/stdc++.h>
using namespace std;

const int maxn=30000+100;
const int INF=0x3f3f3f3f;

int main(){

int n;
scanf("%d",&n);
vector<int>G;
for(int i=1;i<=n+1;i++) G.push_back(INF);
for(int i=1,val;i<=n;i++){

scanf("%d",&val);
*upper_bound(G.begin(),G.end(),val)=val;
}
printf("%d\n",lower_bound(G.begin(),G.end(),INF)-G.begin());
}


本文共计205个文字,预计阅读时间需要1分钟。

牛客OI赛制测试赛E的旅行青蛙模式是怎样的?

项目名称:门牌序列生成器

功能描述:生成一系列门牌号码,门牌号码以递增方式排列。

牛客OI赛制测试赛E的旅行青蛙模式是怎样的?

最长递减子序列:[999, 998, 997, ..., 3, 2, 1]

代码示例:pythondef generate_door_number_sequence(start, end): return list(range(start, end + 1))

生成1到100的门牌号码序列door_number_sequence=generate_door_number_sequence(1, 100)print(door_number_sequence)


​​题目传送门​​​ 最长不下降子序列
代码:

#include<bits/stdc++.h>
using namespace std;

const int maxn=30000+100;
const int INF=0x3f3f3f3f;

int main(){

int n;
scanf("%d",&n);
vector<int>G;
for(int i=1;i<=n+1;i++) G.push_back(INF);
for(int i=1,val;i<=n;i++){

scanf("%d",&val);
*upper_bound(G.begin(),G.end(),val)=val;
}
printf("%d\n",lower_bound(G.begin(),G.end(),INF)-G.begin());
}