Mergeable Stack Time Limit: 2 Seconds Memory Limit: 65536 KB Given initially empty stacks, there are three types of operations: 1 s v: Push the value onto the top of the -th stack. 2 s: Pop the topmost value out of the -th stack, and print tha…
Mergeable Stack Time Limit: 2 Seconds Memory Limit: 65536 KB Given initially empty stacks, there are three types of operations: 1 s v: Push the value onto the top of the -th stack. 2 s: Pop the topmost value out of the -th stack, and print that…
Mergeable Stack Time Limit: 2 Seconds Memory Limit: 65536 KB Given initially empty stacks, there are three types of operations: 1 s v: Push the value onto the top of the -th stack. 2 s: Pop the topmost value out of the -th stack, and print tha…
[传送门]http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4016 [题目大意]初始有n个空栈,现在有如下三种操作: (1) 1 s v 即 s.push(v) (2) 2 s 即 s.pop() 输出弹出的元素,如果栈s为空则输出 "EMPTY" (3) 3 s t 把t栈元素全部移到s栈中,使s的尾部与t的首部相连. 现在有若干上述三种类型的操作,遇到操作2则输出相应内容. [题解]由于站的数量n和操作次数…