当前位置:网站首页>uva1481
uva1481
2022-08-10 02:45:00 【小刀刺大熊】
#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 = 3007;
int a[maxn], b[maxn], pos[maxn], n;
int main()
{
while (cin >> n && n) {
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) {
cin >> b[i];
pos[b[i]] = i;
}
int ans = 0;
for (int i = 0; i < n; i++) {
int l = pos[a[i]], r = l,len = 1;
for (int j = i + 1; j < n; j++) {
l = min(l, pos[a[j]]);
r = max(r, pos[a[j]]);
++len;
if (r - l + 1 == len)++ans;
}
}
cout << ans << endl;
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
《天才基本法》:平行时空的第二次选择,小演员的表现意外出圈
MySQL:你做过哪些MySQL的优化?
plsql 查询数据库操作历史记录(Ctrl + e)
【图像分类】2022-CycleMLP ICLR
MySQL: What MySQL optimizations have you done?
NFG电商系统在元宇宙趋势下做什么?
如何让导电滑环信号更好
2022.8.9 Exam Unique Bid Auction--800 Question Solutions
On the Harvest of Travel
【Kali安全渗透测试实践教程】第7章 权限提升
what is eabi
想要避免After Effects渲染失败的问题,5个小技巧必看
liunx PS1 设置
兴业数金一面
Robust Real-time LiDAR-inertial Initialization (Real-time Robust LiDAR Inertial Initialization) Paper Learning
【Image Classification】2022-CycleMLP ICLR
2022.8.8考试游记总结
P1564 膜拜
2020.11.22 Exam Goldbach Conjecture Solution
【红队】ATT&CK - 自启动 - 利用LSA身份验证包自启动机制









