当前位置:网站首页>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;
}
边栏推荐
- [Kali Security Penetration Testing Practice Tutorial] Chapter 6 Password Attack
- 【图像分类】2022-CycleMLP ICLR
- Instance 042: Variable scope
- what is eabi
- 【Image Classification】2022-CycleMLP ICLR
- [Red Team] ATT&CK - Self-starting - Self-starting mechanism using LSA authentication package
- 驱动程序开发:按键中断之异步通知
- 2022.8.8 Exam questions for photographer Lao Ma (photographer)
- What is a Cross-Site Request Forgery (CSRF) attack?How to defend?
- 【Kali安全渗透测试实践教程】第6章 密码攻击
猜你喜欢
storage of data in memory
socket编程基础
excel高级绘图技巧100讲(二十三)-Excel中实现倒计时计数
Kettle 裁剪表详解(truncate)
[Red Team] ATT&CK - Self-starting - Self-starting mechanism using LSA authentication package
【Kali安全渗透测试实践教程】第9章 无线网络渗透
WPF 实现更换主题色
实例044:矩阵相加
ArcGIS Advanced (1) - Install ArcGIS Enterprise and create an sde library
实例048:数字比大小
随机推荐
Error state based Kalman filter ESKF
实例044:矩阵相加
what is eabi
[Kali Security Penetration Testing Practice Course] Chapter 9 Wireless Network Penetration
yolov5+usb相机
QT模态对话框及非模态对话框学习
Example 043: Scope, class methods and variables
【红队】ATT&CK - 自启动 - 注册表运行键、启动文件夹
MySQL: Introduction to Logging System | Error Log | Query Log | Binary Log: Bin-log Data Recovery Practice | Slow Log Query
Example 045: Summation
高精度加法
官宣出自己的博客啦
【Kali安全渗透测试实践教程】第8章 Web渗透
Will signal with different start time alignment
Example 048: Number ratio size
官宣出自己的博客啦
量化投资学习——在FPGA上运行高频交易策略
Research on IC enterprises
当我操作dms客户端的时候,我要操控好几个阿里云账号下的数据库,但是这边每次切换都会把我的登录记录删
将信号与不同开始时间对齐