[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 122: include(/home/shoeb/public_html/www.matholympiad.org.bd/forum/includes/phpbb-latex.php) [function.include]: failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 122: include() [function.include]: Failed opening '/home/shoeb/public_html/www.matholympiad.org.bd/forum/includes/phpbb-latex.php' for inclusion (include_path='.:/opt/php53/lib/php')
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 122: include(/home/shoeb/public_html/www.matholympiad.org.bd/forum/includes/phpbb-latex.php) [function.include]: failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 122: include() [function.include]: Failed opening '/home/shoeb/public_html/www.matholympiad.org.bd/forum/includes/phpbb-latex.php' for inclusion (include_path='.:/opt/php53/lib/php')
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1042: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4786: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4788: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
BdMO Online Forum • View topic - BdOI 2013 National Problem 4

BdOI 2013 National Problem 4

Discuss everything related to IOI here. For more general or advanced topics use CS forum.

Moderators: bristy1588, Labib

Facebook Twitter

BdOI 2013 National Problem 4

Post Number:#1  Unread postby bristy1588 » Wed Jan 15, 2014 12:04 pm

This is the hardest level of the game. There are N stages in the level. In each stage you will
be given $ Q_i $ balls. Colors of the balls are denoted by an integer between $1$ and $K$. You can
pick up one ball from each stage or skip it (No ball). If you pick up a ball you will gain or lose
some points depending on the last ball you have picked. You know color of the available
balls of each stage and points you'll get for a certain combination. Can you figure out the
maximum point you can get? Note that you wont gain or lose any point for the first ball you
picked. If you skip a stage, you can never go back to that. Means you need to play in order.

INPUT
First line of input will contain number of test cases $ T (T < 150) $. In each case first line will
contain two integers $ N (2 <= N <= 100) $ and $ K (1 <= K <= 100)$. Then there will be N lines
which describe each stage. Each line contains an integer $ Q_i (0 <= Q_i <= 100)$ which denotes
number of balls available in $i^{th} $ stage and then $ Q_i $ integers will denote the colors of the balls
in that stage. Then there will be $ K $ lines, each containing $ K $ integers, $ j^{th} $ integer of ith
line will indicate the point you will gain or lose if you pick a ball of color $ j$ after color $i$. Negative
means you will lose point. Point gain or lose in a step will be at most $1000$.

OUTPUT
For each test case, print the test case number starting from $1$ and a single integer denoting
the maximum point you can get.

SAMPLE INPUT
Code: Select all
2
2 3
3 2 3 2
4 1 1 3 3
1 5 0
1 0 2
-4 1 -5
4 4
1 4
2 3 1
2 2 4
3 4 2 2
-5 -2 3 2
-5 -1 2 0
3 4 5 -4
-3 -5 0 -4


SAMPLE OUTPUT
Code: Select all
Case 1: 2
Case 2: 4
Bristy Sikder
User avatar
bristy1588
 
Posts: 92
Joined: Sun Jun 19, 2011 10:31 am

Share with your friends: Facebook Twitter

Return to International Olympiad in Informatics (IOI)

Who is online

Users browsing this forum: No registered users and 2 guests