当前位置:网站首页>uva10635
uva10635
2022-06-29 06:38:00 【小刀刺大熊】
//因为每个数都不同,可将A数组元素重新编号
//使得A数组为 1 - p+1 的数字
//删除B数组中 A没有的元素 求B数组的最长递增子序列长度 即为答案
#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
const int maxn = 250 * 250 + 7;
int idx[maxn], A[maxn], B[maxn], alen, blen, n;
int main()
{
int t;
cin >> t;
for (int kCase = 1; kCase <= t; kCase++) {
cin >> n >> alen >> blen;
memset(idx, 0, sizeof(idx));
int first = 1;
for (int i = 0; i <= alen; i++) {
cin >> A[i];
if (!idx[A[i]]) {
idx[A[i]] = first++;
}
}
int len = 0;
for (int i = 0; i <= blen; i++) {
cin >> B[len];
if (!idx[B[len]]) continue;
B[len] = idx[B[len]];
++len;
}
vector<int> dp = {
B[0] };
for (int i = 1; i < len; ++i) {
if (B[i] > dp.back()) {
dp.emplace_back(B[i]);
}
else {
auto it = lower_bound(dp.begin(), dp.end(), B[i]);
*it = B[i];
}
}
cout << "Case " << kCase << ": " << dp.size() << endl;
}
return 0;
}
边栏推荐
- Testing grpc service with grpcui
- [translation] [Chapter II ①] mindshare PCI Express technology 3.0
- UVM authentication platform
- VerilogA - dynamic comparator
- List collection implements paging
- 目标检测——使用yolov6进行视频推理
- Configuring MySQL 5.7 and 8 under CentOS
- WordPress adds article topping, password protection, and privacy Tags
- 转:侯宏:企业数字化转型的关键不是技术,而是战略
- . NETCORE uses redis to limit the number of interface accesses
猜你喜欢

开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事

RPC and RMI

Service grid ASM year end summary: how do end users use the service grid?

Idea use

QT qlineedit details

转:侯宏:企业数字化转型的关键不是技术,而是战略

Uniapp obtains the date implementation of the beginning and end of the previous month and the next month

Ci tool Jenkins II: build a simple CI project

关于DDNS
![[when OSPF introduces direct connection routes, it makes a summary by using static black hole routes]](/img/a8/f77cc5e43e1885171e73f8ab543ee4.png)
[when OSPF introduces direct connection routes, it makes a summary by using static black hole routes]
随机推荐
Labor skills courses integrated into steam Education
RPC and RMI
WDCP访问不存在的路径全部跳转到首页不返回404的解决办法
. Net core + DDD basic layering + project basic framework + personal summary "suggestions collection"
NoSQL数据库之Redis(五):Redis_Jedis_测试
[when OSPF introduces direct connection routes, it makes a summary by using static black hole routes]
NoSQL数据库之Redis(四):Redis新数据类型
QT qframe details
Introduction to NoSQL database
Idea integrated code cloud
QT program packaging and publishing windeployqt tool
NoSQL数据库之Redis(四):Redis的发布和订阅
Save token get token refresh token send header header
NoSQL数据库之Redis(一):安装 & 简介
Unity ar shadow shadow
作为一名合格的网工,你必须掌握的 DHCP Snooping 知识!
Uniapp obtains the date implementation of the beginning and end of the previous month and the next month
Daily question - force deduction - multiply the found value by 2
Object detection - VIDEO reasoning using yolov6
Vite快速上手