Chrome Navigation Bar Lite 清爽版浏览器导航栏
Background 背景
Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward. In this problem, you are asked to implement this.
标准的网络浏览器包含在最近访问的页面中向后和向后移动的功能。 实现这些功能的一种方法是使用两个堆栈来跟踪通过向后和向前移动可以达到的页面。 在这个问题中,你被要求实现这个。
Description 解释
The following commands need to be supported:
* BACK: Push the current page on the top of the forward stack. Pop the page from the top of the backward stack, making it the new current page. If the backward stack is empty, the command is ignored.
* FORWARD: Push the current page on the top of the backward stack. Pop the page from the top of the forward stack, making it the new current page. If the forward stack is empty, the command is ignored.
* VISIT <url>: Push the current page on the top of the backward stack, and make the URL specified the new current page. The forward stack is emptied.
* QUIT: Quit the browser.
Assume that the browser initially loads the web page at the URL https://www.astrnuts.com
需要支持以下命令:
* BACK:推送正向堆栈顶部的当前页面。 从向后堆栈的顶部弹出页面,使其成为新的当前页面。 如果反向堆栈为空,则忽略该命令。
* FORWARD(推送):按下反向堆栈顶部的当前页面。 从正向堆栈的顶部弹出页面,使其成为新的当前页面。 如果转发堆栈为空,则忽略该命令。
* VISIT<url>:按下反向堆栈顶部的当前页面,并使URL指定新的当前页面。 正向栈被清空。
* QUIT:退出浏览器。
假设浏览器最初在URL https://www.astrnuts.com 上加载网页
Special Attention 特殊注意
This problem contains multiple test cases!
The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.
The output format consists of N output blocks. There is a blank line between output blocks.
这个问题包含多个测试用例!
多重输入的第一行是整数N,然后是空行,后跟N个输入块。 每个输入块都是问题描述中指示的格式。 输入块之间有空白行。
输出格式由N个输出块组成。 输出块之间有空白行。
I/O Format 交互格式
Input 输入
Input is a sequence of commands. The command keywords BACK, FORWARD, VISIT, and QUIT are all in uppercase. URLs have no whitespace and have at most 70 characters. You may assume that no problem instance requires more than 100 elements in each stack at any time. The end of input is indicated by the QUIT command.
输入是一系列命令。 命令关键字BACK,FORWARD,VISIT和QUIT都是大写的。 网址没有空格,最多70个字符。 您可以假设任何问题的实例在任何时候都需要每个堆栈中超过100个元素。 输入结束由QUIT命令指示。
Output 输出
For each command other than QUIT, print the URL of the current page after the command is executed if the command is not ignored. Otherwise, print "Ignored". The output for each command should be printed on its own line. No output is produced for the QUIT command.
对于QUIT之外的每个命令,如果命令未被忽略,则在命令执行后打印当前页面的URL。 否则,打印“忽略”。 每个命令的输出应该打印在自己的行上。 没有为QUIT命令生成输出。
The Only Sample 唯一的样例
Input 输入
1
VISIT http://astrnut.xyz/
VISIT https://te.astrnut.com/
BACK
BACK
BACK
FORWARD
VISIT http://anc.pe.hu/
BACK
BACK
FORWARD
FORWARD
FORWARD
QUIT
Output 输出
http://astrnut.xyz/
https://te.astrnut.com/
http://astrnut.xyz/
https://www.astrnuts.com
Ignored
http://astrnut.xyz/
http://anc.pe.hu/
http://astrnut.xyz/
https://www.astrnuts.com
http://astrnut.xyz/
http://anc.pe.hu/
Ignored
Limitation 限制
1s, 1024KiB for each test case.
Hint 提示
Since there are much data, but it is not complicated.
数据很多,题目简单。
Source 来源
ACM East Central North America 2001
ACM 中西部美洲竞赛 2001年
Data written by AstrNuts:Sylvie
数据由 AstrNuts:Sylvie 编写
信息
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 3
- 已通过
- 1
- 通过率
- 33%
- 上传者