当前位置:网站首页>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;
}
边栏推荐
- storage of data in memory
- P1564 膜拜
- 2022.8.9 Exam Cube Sum--1100 Question Solutions
- [Red Team] ATT&CK - Self-starting - Self-starting mechanism using LSA authentication package
- what is eabi
- 2022.8.8考试清洁工老马(sweeper)题解
- Introduction and application of quantitative trading strategies
- 想要避免After Effects渲染失败的问题,5个小技巧必看
- What is a Cross-Site Request Forgery (CSRF) attack?How to defend?
- what is eabi
猜你喜欢
随机推荐
Anchor_generators.py analysis of MMDetection framework
维度表设计
Meteor accelerator Trojan analysis and disposal plan
Example 043: Scope, class methods and variables
量化交易策略介绍及应用市值中性化选股
flutter 创建可增型列表和列表排序
Arcgis进阶篇(1)——安装Arcgis Enterprise,创建sde库
Excel Advanced Drawing Skills 100 Lectures (23) - Countdown Counting in Excel
基于误差状态的卡尔曼滤波ESKF
将信号与不同开始时间对齐
IDEA自动生成serialVersionUID
驱动程序开发:无设备树和有设备树的platform驱动
推荐几款好用的MySQL开源客户端,建议收藏
官宣出自己的博客啦
State compression small experience
2022.8.8 exam sweeps the horse (sweeper) antithesis
小菜鸟河北联通上岗培训随笔
socket编程基础
使用curl指令发起websocket请求
(十四)时间延时任务及定时任务