当前位置:网站首页>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;
}
边栏推荐
- 论文理解:“PIAT: Physics Informed Adversarial Training for Solving Partial Differential Equations“
- Pycharm中6个常用插件推荐
- excel高级绘图技巧100讲(二十三)-Excel中实现倒计时计数
- 2022.8.8 Exam written in memory (memory)
- 【Kali安全渗透测试实践教程】第9章 无线网络渗透
- PostgreSQL相关语法及指令示例
- what is a microcontroller or mcu
- nodejs 时钟案例(fs模块),重复使用fs.writeFile方法,旧内容会被覆盖
- 实例046:打破循环
- On the Harvest of Travel
猜你喜欢

从滑动标尺模型看企业网络安全能力评估与建设

Pycharm中6个常用插件推荐

【图像分类】2022-CycleMLP ICLR

【图像分类】2022-ResMLP

HACKTHEBOX——Bank

Robust Real-time LiDAR-inertial Initialization (Real-time Robust LiDAR Inertial Initialization) Paper Learning

【语义分割】2022-HRViT CVPR

二维空间下的向量旋转

Introduction and application of quantitative trading strategies

MySQL: Introduction to Logging System | Error Log | Query Log | Binary Log: Bin-log Data Recovery Practice | Slow Log Query
随机推荐
Chip Accelerator
高精度加法
Example 047: Functions Swap Variables
liunx PS1 设置
2022.8.8 Exam questions for photographer Lao Ma (photographer)
2022.8.8考试区域链接(district)题解
what is a microcontroller or mcu
Introduction and application of quantitative trading strategies
Excel Advanced Drawing Skills 100 Lectures (23) - Countdown Counting in Excel
IDEA自动生成serialVersionUID
Completion of the flag set in 2022
GDB之指令基础参数
流星加速器木马分析与处置方案
socket编程基础
what is eabi
P1564 膜拜
实例042:变量作用域
HackTheBox——Beep
HRnet
网路编程_调试accept