• [B] Reimu's Teleport

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Hakurei Reimu(はくれい·れいむ) has an ability - Teleport. She can transport herself from here to anywhere flashily.
    When she is teleporting above a grassland from left to right, the grass between the distance she teleported will face to the right because of the teleporting wind. When she is from right to left, it will face to left.
    At the very beginning, all the grass is face to the sky (neither facing to left nor to right).

    Your task is to calculate out that how many grasses is facing to left, how many is facing to right and how many is facing to the sky between a querying distance.

  • 输入
  • This problem has several cases.
    The first line of each case is two integer A and T(0 < A <= 10000, 0 < T <= 100000), A means the number of action and T is the max coordinate of the grassland.
    Then follows A lines.
    Each line contains a command, 'F' of 'Q'.
    If the command is F, then it follows 2 integers D1 and D2(0 < D1, D2 <= T, D1 ≠ D2), means Reimu teleports from D1 to D2. The smaller one is left and the bigger one is right.
    If the command is Q, then it follows 2 integers D1 and D2(0 < D1 <= D2 <= T), means you have to calculate out now how many grasses is facing to left, how many is facing to right and how many is facing to the sky between D1 and D2.
  • 输出
  • For each command 'Q', you have to print the number of each facing side in a single line(from left, top to right).
  • 样例输入
  • 3 10
    F 1 2
    F 10 9
    Q 1 10
    
  • 样例输出
  • 2 6 2
    
  • 提示
  • For the sample, the grass will be "rrttttttll" when querying.
    
  • 来源
  • XadillaX
  • 操作

显示春菜