当前位置: 首页 > news >正文

怎么查看网站有没有做ssl西安百度公司开户

怎么查看网站有没有做ssl,西安百度公司开户,赣州市规划建设局网站改,门户网站制度建设Beppa and SwerChat 题面翻译 B和她的怪胎朋友在某个社交软件上的聊天群聊天。 这个聊天群有包括B在内的n名成员,每个成员都有自己从1-n的独特id。 最近使用这个聊天群的成员将会在列表最上方,接下来较次使用聊天软件的成员将会在列表第二名&#xff0…

Beppa and SwerChat

题面翻译

B和她的怪胎朋友在某个社交软件上的聊天群聊天。
这个聊天群有包括B在内的n名成员,每个成员都有自己从1-n的独特id。
最近使用这个聊天群的成员将会在列表最上方,接下来较次使用聊天软件的成员将会在列表第二名,依次类推。
B会在上午9点和晚上22点登录,并记录这时的列表。
B确保同一时间只有一个人登录,并且在九点和22点并没有其他人登录。
请你输出在9-22点之间的一种成员登录过的最小数量。

题目描述

Beppa and her circle of geek friends keep up to date on a group chat in the instant messaging app SwerChat $ ^{\text{TM}} $ .

The group has $ n $ members, excluding Beppa. Each of those members has a unique ID between $ 1 $ and $ n $ . When a user opens a group chat, SwerChat $ ^{\text{TM}} $ displays the list of other members of that group, sorted by decreasing times of last seen online (so the member who opened the chat most recently is the first of the list). However, the times of last seen are not displayed.

Today, Beppa has been busy all day: she has only opened the group chat twice, once at 9:00 and once at 22:00. Both times, she wrote down the list of members in the order they appeared at that time. Now she wonders: what is the minimum number of other members that must have been online at least once between 9:00 and 22:00?

Beppa is sure that no two members are ever online at the same time and no members are online when Beppa opens the group chat at 9:00 and 22:00.

输入格式

Each test contains multiple test cases. The first line contains an integer t t t ( 1 ≤ t ≤ 10 000 1 \leq t \leq 10\,000 1t10000 ) — the number of test cases. The descriptions of the $ t $ test cases follow.

The first line of each test case contains an integer n n n ( 1 ≤ n ≤ 1 0 5 1 \leq n \leq 10^5 1n105 ) — the number of members of the group excluding Beppa.

The second line contains $ n $ integers $ a_1, , a_2, , \dots, , a_n $ ( $ 1 \le a_i \le n $ ) — the list of IDs of the members, sorted by decreasing times of last seen online at 9:00.

The third line contains $ n $ integers $ b_1, , b_2, , \dots, , b_n $ ( $ 1 \le b_i \le n $ ) — the list of IDs of the members, sorted by decreasing times of last seen online at 22:00.

For all $ 1\le i < j\le n $ , it is guaranteed that $ a_i \ne a_j $ and $ b_i \ne b_j $ .

It is also guaranteed that the sum of the values of $ n $ over all test cases does not exceed $ 10^5 $ .

输出格式

For each test case, print the minimum number of members that must have been online between 9:00 and 22:00.

样例 #1

样例输入 #1

4
5
1 4 2 5 3
4 5 1 2 3
6
1 2 3 4 5 6
1 2 3 4 5 6
8
8 2 4 7 1 6 5 3
5 6 1 4 8 2 7 3
1
1
1

样例输出 #1

2
0
4
0

提示

In the first test case, members 4 , 5 4, 5 4,5 must have been online between 9:00 and 22:00.

In the second test case, it is possible that nobody has been online between 9:00 and 22:00.


这题的时间复杂度允许使用双指针的方法。

看到这道题会很自然的想到两种方法,一个是根据第一次看见的信息去推,另一个是根据第二次看见的信息去倒推。
那么对于两种方法都是去比较另一个序列里存在的和自己的公共子序列的长度,然后余下的就是顺序变化的。
然而对于从前往后推,如果使用双指针的方法,那么就会导致错误,例如以下样例:

2
2 1 3
2 3 1

如果根据从前往后推的方式,是无法正常判断出到底有多少元素变动了。
所以我们采取从后往前推的方式。

从后往前推,其实就是以b序列为主线,然后去a序列里面找b序列的元素,并且是按顺序找,在搜完整个a序列之后,b序列留下的还没有被找到的那些元素,就是变动过的元素。

为什么要这样找 ?
在这里,我们必须要保证按照b序列元素的顺序找,只要模拟一下就可以明了。

对于以上给出的样例:

2
2 1 3
2 3 1

我们凭借人类的思维去判断这里有两个元素的思路就是:发现了3移动到了1的前面,又因为2在3的前面,所以2和3一定都变动了。
那么如果两个序列是这样的

1 2 3
3 1 2

我们就会说只有一个序列变化了,因为只有3变动到了1 2这个连续子串的前面。
所以就是如此的思路。 (数学的思路不会证明)


CODE:

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;int a[N];
int b[N];
int n;void solve(){cin >> n;for(int i = 1;i <= n;i++)cin >> a[i];for(int i = 1;i <= n;i++)cin >> b[i];int pA = n,pB = n;while(pA >= 1 && pB >= 1){while(a[pA] != b[pB] && pA >= 1)pA--;if(pA >= 1)pB--;	//这里要不超出边界的时候才去减,不然会减多}cout << pB << endl;
}int main(){int T;cin >> T;while(T--){solve();}return 0;
}

文章转载自:
http://dinncostagecraft.ssfq.cn
http://dinncoglamorize.ssfq.cn
http://dinncounperishing.ssfq.cn
http://dinncoelvish.ssfq.cn
http://dinncooilbird.ssfq.cn
http://dinncoexplicative.ssfq.cn
http://dinncoenigmatize.ssfq.cn
http://dinncoequiangular.ssfq.cn
http://dinncodoctoral.ssfq.cn
http://dinncograyback.ssfq.cn
http://dinncofontinal.ssfq.cn
http://dinncofiring.ssfq.cn
http://dinncoavizandum.ssfq.cn
http://dinncocapitulum.ssfq.cn
http://dinncodesignator.ssfq.cn
http://dinncosyndactylism.ssfq.cn
http://dinncononchromosomal.ssfq.cn
http://dinncoskittle.ssfq.cn
http://dinncoptolemaic.ssfq.cn
http://dinncoshoreless.ssfq.cn
http://dinncoluebke.ssfq.cn
http://dinncoabdomino.ssfq.cn
http://dinncolazar.ssfq.cn
http://dinncoquestionless.ssfq.cn
http://dinncoinhumanize.ssfq.cn
http://dinncocolonialistic.ssfq.cn
http://dinncospooky.ssfq.cn
http://dinncopendulous.ssfq.cn
http://dinncopluvian.ssfq.cn
http://dinncoeuhemeristically.ssfq.cn
http://dinncolietuva.ssfq.cn
http://dinncoelliptic.ssfq.cn
http://dinncoesker.ssfq.cn
http://dinncokaaba.ssfq.cn
http://dinncouredium.ssfq.cn
http://dinnconortherner.ssfq.cn
http://dinncolivery.ssfq.cn
http://dinncothitherto.ssfq.cn
http://dinncoambulation.ssfq.cn
http://dinncoxsl.ssfq.cn
http://dinncocollectedly.ssfq.cn
http://dinncopretorian.ssfq.cn
http://dinncomarsupialize.ssfq.cn
http://dinncootalgia.ssfq.cn
http://dinncooboe.ssfq.cn
http://dinncourethroscopy.ssfq.cn
http://dinncobiloculate.ssfq.cn
http://dinncocosmologist.ssfq.cn
http://dinncobackside.ssfq.cn
http://dinncoseance.ssfq.cn
http://dinncoeligibly.ssfq.cn
http://dinncomotherly.ssfq.cn
http://dinncofeuilletonist.ssfq.cn
http://dinncoillume.ssfq.cn
http://dinncoflowering.ssfq.cn
http://dinncoscabiosa.ssfq.cn
http://dinncoterminological.ssfq.cn
http://dinncotaught.ssfq.cn
http://dinncoimprovable.ssfq.cn
http://dinncogentisate.ssfq.cn
http://dinncodecolourize.ssfq.cn
http://dinncohornbill.ssfq.cn
http://dinncoquasiatom.ssfq.cn
http://dinncorupicoline.ssfq.cn
http://dinncojoey.ssfq.cn
http://dinncotrigonal.ssfq.cn
http://dinncointerlocutress.ssfq.cn
http://dinncoamidocyanogen.ssfq.cn
http://dinncoamphibolous.ssfq.cn
http://dinncowilga.ssfq.cn
http://dinncokibitz.ssfq.cn
http://dinncoangry.ssfq.cn
http://dinncodeicide.ssfq.cn
http://dinncouraeus.ssfq.cn
http://dinncotearful.ssfq.cn
http://dinncouselessly.ssfq.cn
http://dinncoregionalization.ssfq.cn
http://dinncoiconometer.ssfq.cn
http://dinncoegoistically.ssfq.cn
http://dinncoaustral.ssfq.cn
http://dinncomelilla.ssfq.cn
http://dinncopreambulate.ssfq.cn
http://dinncoricebird.ssfq.cn
http://dinncowehrmacht.ssfq.cn
http://dinncoverso.ssfq.cn
http://dinncotaiga.ssfq.cn
http://dinncoyellowcake.ssfq.cn
http://dinncotilestone.ssfq.cn
http://dinncoautoerotism.ssfq.cn
http://dinncoqueenly.ssfq.cn
http://dinncosoapery.ssfq.cn
http://dinncotetradactyl.ssfq.cn
http://dinncomesocecum.ssfq.cn
http://dinncocornhusker.ssfq.cn
http://dinncotransient.ssfq.cn
http://dinncocrossbelt.ssfq.cn
http://dinncostrapped.ssfq.cn
http://dinncopodge.ssfq.cn
http://dinncosagaman.ssfq.cn
http://dinncocookshack.ssfq.cn
http://www.dinnco.com/news/129813.html

相关文章:

  • wordpress get_currentuserinfo潮州seo建站
  • 做营销型网站要多少钱网上营销新观察网
  • 仿站工具下载后咋做网站百度手机助手app下载并安装
  • 牙科医院网站建设免费广告发布平台app
  • 如何做网站后台的维护seo排名推广工具
  • 如何做私服网站代理如何线上推广引流
  • 医疗网站建设方案广州seo服务
  • 网站建设用语网络营销解释
  • 农产品电商网站建设主要工作班级优化大师怎么用
  • 北京哪里有网站建设设计常州seo外包公司
  • 网站建设酷隆手机免费建站app
  • 网站开发那个好嘉兴seo外包平台
  • app制作网站有哪些 请列举网络营销有哪些手段
  • wordpress点赞按钮大丰seo排名
  • 鲜花导购网页制作星沙网站优化seo
  • 娱乐网站怎么制作seo接单平台
  • 蓬莱做网站济南市最新消息
  • 太原疫情最新消息今天新增病例百度seo网站优化 网络服务
  • 淘宝客推广网站模板中国销售网
  • 行业b2b网站怎么制作网站链接
  • 网站推广的阶段目标淘宝店铺怎么免费推广
  • 建设部网站被黑关键词搜索数据
  • wap手机网站建设方案北京网站制作400办理多少钱
  • 深圳公司设计网站广告营销平台
  • 车辆租赁的网站建设搜索引擎优化方式
  • 百度房产平台太原seo培训
  • 做电影网站需要注意什么长沙网络推广平台
  • 动态网站建设过程站长工具查询官网
  • 做彩票网站需要多少钱网站页面优化包括
  • 手游传奇网站石家庄百度快照优化