【深基15.习9】验证栈序列
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
给出两个序列 pushed 和 poped 两个序列,其取值从 1 到 。已知入栈序列是 pushed,如果出栈序列有可能是 poped,则输出 Yes
,否则输出 No
。为了防止骗分,每个测试点有多组数据,不超过 组。
输入格式
第一行一个整数 ,询问次数。
接下来 个询问,对于每个询问:
第一行一个整数 表示序列长度;
第二行 个整数表示入栈序列;
第三行 个整数表示出栈序列;
输出格式
对于每个询问输出答案。
2
5
1 2 3 4 5
5 4 3 2 1
4
1 2 3 4
2 4 1 3
Yes
No
0228c班开学考
- Status
- Done
- Rule
- IOI
- Problem
- 5
- Start at
- 2025-2-28 18:30
- End at
- 2025-2-28 21:00
- Duration
- 2.5 hour(s)
- Host
- Partic.
- 27