当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
Given 3 × n positive integers:
A1, A2, A3, ... An;
B1, B2, B3, ... Bn;
C1, C2, C3, ... Cn;
and a set of m pairs of integer < Si, Ti >, your task is to find a non-negative real solution for the following equations:
A1X1 + A2X2 + A3X3 + ... + AnXn = Si
B1X1 + B2X2 + B3X3 + ... + BnXn = Ti
that maximizes C1X1 + C2X2 + C3X3 + ... + CnXn
The first line contains two numbers n (1 ≤ n ≤ 100000) and m (1 ≤ m ≤ 10000).
The following n lines each contain three integers Ai, Bi, Ci (1 ≤ Ai, Bi, Ci ≤ 10000). The next m lines each contain two integers Si and Ti (1 ≤ Si, Ti ≤ 10000).
For each pair < Si, Ti >, output the maximum value or IMPOSSIBLE if no solution exists.
2 2 2 2 2 3 1 1 4 2 4 1
2.00000 IMPOSSIBLE
时间上限 | 内存上限 |
1000 | 65536 |