21910_GreatWorldofGoo

2022-5-16 18:20| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505949764600-Problem List-采集的数据-后羿采集器.html

Pro.ID

21910

Title

Great World of Goo

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21910

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 4000/2000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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 CP and DP (inclusive). Two restrictions may be the same or partly same. Every restriction is legal.

    输出

    Description

    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.

    Input

    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 CP and DP (inclusive). Two restrictions may be the same or partly same. Every restriction is legal.

    Output

    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 216-1. So when the number of solutions exceeds 216-1, we must output "OVERFLOW!", otherwise, output the accurate number of solutions.

    Sample Input

    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

    Sample Output

    720
    0
    OVERFLOW!

    Source

    样例输入

    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!

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部