10556: T368993 「QFOI R1」抱抱

内存限制:128 MB 时间限制:1.000 S 提交:2 解决:1
评测方式:文本比较 命题人:

题目描述

小 R 是一个可爱的女孩子,她希望跟大家抱抱,顺便给大家分蛋糕吃。

蛋糕是一个大小为 lns="http://www.w3.org/1998/Math/MathML">×× 的长方体,其中每个单位正方体都被赋予了一个坐标 lns="http://www.w3.org/1998/Math/MathML">(,,)lns="http://www.w3.org/1998/Math/MathML">1,1,1)。

共进行 lns="http://www.w3.org/1998/Math/MathML"> 次切蛋糕操作,每次按如下三种方式之一切分:

  1. 切出 lns="http://www.w3.org/1998/Math/MathML"> 的部分分给大家。
  2. 切出 lns="http://www.w3.org/1998/Math/MathML"> 的部分分给大家。
  3. 切出 lns="http://www.w3.org/1998/Math/MathML"> 的部分分给大家。

由于她自己也想吃蛋糕,她希望知道在每次切蛋糕后,还剩下多少体积没有分给大家。

输出

输入格式

inkMacSystemFont, "font-size:16px;white-space:normal;background-color:#FFFFFF;">

第一行四个整数 lns="http://www.w3.org/1998/Math/MathML">,,,,表示蛋糕的大小和切蛋糕次数。

接下来 lns="http://www.w3.org/1998/Math/MathML"> 行,每行两个整数 lns="http://www.w3.org/1998/Math/MathML">,,表示进行【题目描述】中的第 lns="http://www.w3.org/1998/Math/MathML"> 种操作,参数为 lns="http://www.w3.org/1998/Math/MathML">

输出格式

inkMacSystemFont, "font-size:16px;white-space:normal;background-color:#FFFFFF;">

lns="http://www.w3.org/1998/Math/MathML"> 行,每行一个整数,表示剩余部分体积。

样例输入 复制

3 3 3 2
1 2
2 1

样例输出 复制

9
6

提示

说明/提示

inkMacSystemFont, "font-size:16px;white-space:normal;background-color:#FFFFFF;">

样例 lns="http://www.w3.org/1998/Math/MathML">1 解释

第一次切蛋糕,将所有 lns="http://www.w3.org/1998/Math/MathML">2 的部分切掉,剩余的单位正方体有 lns="http://www.w3.org/1998/Math/MathML">(3,1,1),(3,1,2),(3,1,3),(3,2,1),(3,2,2),(3,2,3),(3,3,1),(3,3,2),(3,3,3) 共 lns="http://www.w3.org/1998/Math/MathML">9 个。

第二次切蛋糕,将所有 lns="http://www.w3.org/1998/Math/MathML">1 的部分切掉,剩余的单位正方体有 lns="http://www.w3.org/1998/Math/MathML">(3,2,1),(3,2,2),(3,2,3),(3,3,1),(3,3,2),(3,3,3) 共 lns="http://www.w3.org/1998/Math/MathML">6 个。


样例 lns="http://www.w3.org/1998/Math/MathML">2 解释

第四次切蛋糕没有任何作用,因为第二次切蛋糕时 lns="http://www.w3.org/1998/Math/MathML">654321 的部分已经被切掉,此时已经不存在 lns="http://www.w3.org/1998/Math/MathML">111111 的单位正方体。

注意每次操作中的参数 lns="http://www.w3.org/1998/Math/MathML"> 是初始时决定的绝对坐标,不会随着操作的进行而改变。


数据范围

本题共 lns="http://www.w3.org/1998/Math/MathML">20 个测试点,每个测试点 lns="http://www.w3.org/1998/Math/MathML">5 分。

对于全部数据,保证 lns="http://www.w3.org/1998/Math/MathML">1,,106lns="http://www.w3.org/1998/Math/MathML">12×105lns="http://www.w3.org/1998/Math/MathML">{1,2,3},若 lns="http://www.w3.org/1998/Math/MathML">=1 则 lns="http://www.w3.org/1998/Math/MathML">1,若 lns="http://www.w3.org/1998/Math/MathML">=2 则 lns="http://www.w3.org/1998/Math/MathML">1,若 lns="http://www.w3.org/1998/Math/MathML">=3 则 lns="http://www.w3.org/1998/Math/MathML">1

  • 对于测试点 lns="http://www.w3.org/1998/Math/MathML">15:保证 lns="http://www.w3.org/1998/Math/MathML">,,,100
  • 对于测试点 lns="http://www.w3.org/1998/Math/MathML">610:保证 lns="http://www.w3.org/1998/Math/MathML">==1lns="http://www.w3.org/1998/Math/MathML">=1
  • 对于测试点 lns="http://www.w3.org/1998/Math/MathML">1115:保证 lns="http://www.w3.org/1998/Math/MathML">=1lns="http://www.w3.org/1998/Math/MathML">{1,2}
  • 对于测试点 lns="http://www.w3.org/1998/Math/MathML">1620:无特殊限制。