• [1323] TT's Second Trial

  • 时间限制: 1800 ms 内存限制: 65535 K
  • 问题描述
  • TT had passed the first challenge, now she faced the second one. This time Mr.Cai gave TT some number, and some commands: X dir Y, dir include L and R, if L means put Y left X, if R, put Y right X.
    TT played the woman to Mr.Cai, so Mr.Cai had to lower the difficulty, he said all numbers would not repeat more than twice, that means you can find the only position X.
  • 输入
  • There are many cases. Each include a integer N(1 <= N <= 1000), then followed N numbers. Next line a integet K(1 <= K <=80000), then K lines followed. Each line with a command.All number will no more than the range of K+N.
  • 输出
  • For each case, output the final array in a single line.
  • 样例输入
  • 3
    1 2 3
    4
    1 R 4
    3 L 5
    2 L 6
    2 L 7
  • 样例输出
  • 1 4 6 7 2 5 3
  • 提示
  • 来源
  • Mr.Cai
  • 操作

显示春菜