ECOO '18 R2 P1 - Artificial Photosynthesystem

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 30.0s
Memory limit: 64M

Problem type

The technology world is currently working on a way to generate oxygen so that we can combat the effects of climate change. One of the ways that this is being done is through the creation of an artificial photosynthesystem.

the basic idea behind the process is that you need an artificial "leaf" and an artificial "fish" submerged into a vat of carbonated sugar water, which consists of sugar (S), water (W), oxygen (O), and carbon dioxide (C). The leaf is capable of photosynthesis, meaning it consumes some amount of carbon dioxide and water and produces sugar and oxygen. Likewise, the fish is capable of respiration, meaning that it consumes sugar and oxygen to produce carbon dioxide and water.

The plan is to create as much oxygen as possible in order to release it into the environment. There have been different experiments completed on the use of this technique, and each of the leaves and fish that were used have generated a different set of data.

Given the following input experimentation data, you are tasked with calculating the largest amount of oxygen that can be generated with this simple artificial photosynthesystem. Someone has already crunched through the data for you, and has calculated the approximate ratios of input versus outputs.

Input Specifications

The standard input will contain 10 datasets. Each data set consists of three lines.

  • The first line contains four integers C, O, W, S (1\leq C,O,W,S\leq10), the number of units of each molecule in the initial carbonated sugar water solution.
  • The second line contains four integers C_i, W_i, S_o, O_o (1\leq C_i, W_i, S_o, O_o\leq10,C_i+W_i>S_o+O_o) representing the photosynthesis reaction: the leaf can consume C_i units of carbon dioxide and W_i units of water to produce S_o units of sugar and O_o units of oxygen.
  • The third line contains four integers S_i, O_i, C_o, W_o (1\leq S_i, O_i, C_o, W_o\leq10,S_i+O_i>C_o+W_o) representing the respiration reaction: the fish can consume S_i units of sugar and O_i units of oxygen to produce C_o units of carbon dioxide and W_o units of water.

Output Specifications

For each data set, output the maximum number units of oxygen that can be produced using the system.

Sample Input (Two Datasets Shown)

4 4 4 4
2 1 1 1
2 1 1 1
3 4 4 4
2 2 1 2
2 1 1 1

Sample Output


Explanation for Sample Dataset

In case one, photosynthesizing twice gives you 6 oxygen. In case two, respiring once gives you enough carbon dioxide to photosynthesize twice, resulting in a total of 7 oxygen.


There are no comments at the moment.