当前位置:网站首页>1045 Favorite Color Stripe (30 分)
1045 Favorite Color Stripe (30 分)
2022-07-22 10:33:00 【学编程的蒟蒻】
1045 Favorite Color Stripe (30 分)
思路有空更新
#include <iostream>
using namespace std;
int a[10010], vis[10010], dp[10010];
int main() {
int n, m, l, x, ret = 0;
cin >> n >> m;
for(int i = 1; i <= m; ++i){
cin >> x;
vis[x] = i;
}
cin >> l;
while(l--) {
cin >> x;
if(vis[x] != 0)
a[ret++] = vis[x];
}
int ans = 0;
for(int i = 0; i < ret; ++i){
dp[i] = 1;
for(int j = 0; j < i; ++j)
if(a[j] <= a[i])
dp[i] = max(dp[i], dp[j] + 1);
ans = max(ans, dp[i]);
}
cout << ans;
}
边栏推荐
- 本地镜像发布到私有库
- How to repair DNS hijacking perfectly? How to solve DNS hijacking and how to repair it perfectly
- LeetCode912——sort an array—— quick sort algorithm
- 她力量系列三丨把握当下,坚持热爱,与食物图像识别结缘的科研之路
- 1087 All Roads Lead to Rome (30 分)
- 1068 Find More Coins (30 分)
- LeetCode0003——longest substring without repeating characters——Sliding Window
- LeetCode146——LRU Cache——DS Design
- The well-known software adsafe conceals malicious code to hijack traffic from many websites
- Statistical analysis of offline log collection
猜你喜欢
How to solve the blue screen problem in win8.1 system and how to solve the malicious hijacking of IE home page?
Easy operation commands of ES for getting started with elastic search (II)
IDEA下载源码查看
信号降噪方法
Exclusive interview with Huang Hui, a scholar of women in AI: dream of drawing shapes and find the door to breakthrough
She studied in the fourth series of strength, changed her tutor twice in six years, and with a little "stubbornness", Yu Zhou became one of the pioneers of social Chatbot
LeetCode21——Merge two sorted lists——Iteration or recursion
mysql索引
Introduction to machine learning: support vector machine-6
The well-known software adsafe conceals malicious code to hijack traffic from many websites
随机推荐
Flask Cross - Domain
图像质量评估
Getting started with CSDN markdown editor
On the horizontal trigger and edge trigger of epoll
redission分布式锁种类
Generate an external inspection script to delete all tables in the database
LeetCode32——next permutation
docker搭建mysql主从复制
Replace some escape characters with characters of the specified standard
本地镜像发布到阿里云
她力量系列八丨陈丹琦:我希望女生能够得到更多的机会,男生和女生之间的gap会逐渐不存在的
信号降噪方法
Advent of code 2020 -- 登机座位问题
Leetcode0002——Add Two Numbers——Linked List
Her power series 6 - Yang Di 1: when the girl grows up, she can be good at mathematics and chemistry, and scientific research can be very fresh
Her power series five Zhu Haiyi: people oriented, building AI values
本地镜像发布到私有库
进程的互斥、同步
SSM framework integration
vim 使用tips