当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2878:Great World of Goo

题目描述
The game is built around the idea of creating large structures using balls of goo. It is based on the prototype game Tower of Goo developed for Kyle Gabler's rapid game prototyping Experimental Gameplay Project. The game is divided into five chapters, each containing several levels. Each level has its own graphic and musical theme, giving it unique atmosphere, similar in style to Tim Burton's film designs. There is also a bonus meta-game called World of Goo Corporation, where the objective is to build the highest tower using goo balls which the player collected through the course of the game. Players from all over the world can compete, as the height of the tower and number of goo balls used are being constantly uploaded to the 2D Boy server.
--Wikipedia
As mentioned above, World of Goo is an excellent independent game. Personally I like playing it rather than Plants vs. Zombies though both of them are great.
Let’s consider a simplified version of “Fisty Bog” in Chapter One (Figure 1).


(Figure 1)

Ignore the part before the red line, as it’s given by the system initially. The following goo balls make the bridge using regular triangles, numbered from 1, beginning from left to right. To ensure the bridge formed strictly horizontal, we place a light goo ball every three triangles, and in this problem we don’t need to care about those balls.

From the figure we know that, some triangles are more danger during the construction process. For that case, goo balls want to be placed in different triangles. Risky goo balls want to be placed on the triangle more danger while others want safer ones. Now, my question comes, how many number of solutions exist when all goo balls are used and all wills are satisfied.
输入解释
The first line: and integer k (k<=15) indicates the number of test case;
For each test case:
First line: n and m, 0<m,n<=500 , n represents the number of goo balls, m represents the number of wills;
Line 2…m+1:
Each line is consist of integers K A1 B1 A2 B2 … AK BK P C1 D1 C2 D2 … CP DP, represents a restriction. That means the goo ball(s) numbered between A1 and B1 (inclusive), or between A2 and B2 (inclusive) or … or between Ak and Bk (inclusive) wants to be placed at triangle(s) number between C1 and D1 (inclusive), or between C2 and D2 (inclusive) or … or between Ck and Dk (inclusive). Two restrictions may be the same or partly same. Every restriction is legal.
输出解释
For each test case, output one line with following rules.
Because in the world of goo, they only used 16bit system, which means the max number can be stored in one unit is 2^16-1. So when the number of solutions exceeds 2^16-1, we must output “OVERFLOW!”, otherwise, output the accurate number of solutions.
输入样例
3
6 1
1 1 6 1 1 4
6 1
1 1 6 1 1 3
10 1
1 1 10 1 1 8
输出样例
720
0
OVERFLOW!
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2878

最后修改于 2020-10-25T22:57:46+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 65535/65535K(Java/Others)