找回密码
 欢迎注册
楼主: troy

[分享] Invitation for CodeCraft 2008 - IIIT Hyd's Online Programming Contest

[复制链接]
 楼主| 发表于 2008-1-27 23:46:52 | 显示全部楼层
J:
Jazzy Job

With the magnification of the Energy Crisis, Chemists have decided to re-examine the existing procedures of preparation of various Chemical Substances.

As part of this Project, they list all the elements that they commonly find as raw material (Initial Reactants), and the ones that they intend to produce (Final Products). They also prepar e an extensive list of the various known reactions/processes that are used to convert one substance to another.

One major issue that they find is that the Initiation of many reactions needs absurdly large amounts of energy. They wish to keep low the activation energies used in the new procedures.

Knowing all this, they now attempt to find out such methods of preparing the target substances :
(1) in which the highest value of activation energy needed by any of the reactions that make up the path, in any of the methods, does not exceed a given upper value,
(2) which minimizes the Total reactions/procedures performed in All the (Initial Reactant) --> (Final Product) conversions.

Each substance, on being given a specific amount of energy, converts into some other substance. The formed substance is unique for a particular value of Energy. The process of creating each successive Target Substance (Final Product) starts from one of the Source Substances Only, and leaves no by-products.

Your task is to find the minimum value of upper bound such that all final products are obtainable with that upper bound and for this minimum value, find out the minimum number of conversions to get all the final products.

Note: None of the procedures are Reversible, unless explicity stated. Also, if a procedure Is reversible, the Energy requirement may or may not be same. You may assume that there is a limitless supply of the Initial Reactants.


Input Desciption

The first line contains an integer t which is the number of test cases.

Each test case begins with a line containing three integers : number of Initial Reactants(S), Final Products(D) and the total number of elements (N). Then S+D lines follow, first S lines contain IDs of Initial reactant ( 0 based ) and next D lines contain ID's of Final products ( 0 based). Then follows a line containing an integer R which is number of reactions possible. Then follow R lines , each containing three integers , the Substance(S) , the converted substance(C) and the activation energy(A) units required for the reaction. 0 ≤ S,C < n.
Output Description

For each test case , output in a different line ,2 integers (a,b) separated by spaces where a is the minimum upper value and b is the minimum number of conversions required for corresponding a. In case that all final products are not obtainable for any value of upper bound, Print a single line with message "Excessive Energy.".

Sample Input

1
2 2 6
1
3
0
3
6
1 2 2
2 4 3
4 5 1
4 2 2
3 0 4
5 0 1

Sample Output
3 4

Constraints And Limits

Dataset 1: N ≤ 1000, S ≤ N,D ≤ N,R < 50000, 0 < A ≤ 100 Memory Limit: 128 MB. Time Limit: 3 sec. 50 points.
Dataset 2: N ≤ 10000, S ≤ N,D ≤ N,R < 100000 0 < A < 1000000000 Memory Limit: 128 MB. Time Limit: 3 sec. 100 points.
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2008-1-28 00:42:47 | 显示全部楼层
Rank Team Name Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Score Penalty
1. MountainKing 100 200 150 150 300 200 - 250 0 150 1500 1020
2. evils 100 200 150 150 - 200 - 250 250 150 1450 1914
3. Kamikadze 100 200 150 150 - 200 0 250 0 150 1200 908
4. Excalibur 100 200 150 150 - 200 - 250 0 150 1200 1021
5. Arbiter 100 200 150 150 - 200 - 250 - 150 1200 1120
6. mary 100 200 150 150 - 200 - 250 - 150 1200 1221
7. TNU_Team1 100 200 150 150 - 200 0 250 - 150 1200 1414
8. GoogleKoalas 100 200 150 150 - 200 - 250 0 150 1200 1899
9. gawry 100 200 150 150 - 200 - 250 - 0 1050 986
10. StrictMath 100 200 0 150 - 200 - 250 - 150 1050 1217

Team Info : MountainKing
Members :  Tiancheng Lou
Organisation :  Tsinghua University
Country :  CHINA
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2008-1-28 16:45:17 | 显示全部楼层
楼教主还是最厉害的~~~~~~~~~
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-4-25 04:40 , Processed in 0.151100 second(s), 14 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表