QOJ.ac

QOJ

Limite de temps : 3 s Limite de mémoire : 1024 MB Points totaux : 100

#4899. 機器

Statistiques

假定你是李華。

作為一名優秀的文科生,你最近學習了電學。

你有 $\infty$ 個電荷量為 $+e$,動能足夠大的點電荷,要將其中的一部分通入一個機器,並通出等量點電荷。最大化機器運作後電荷的動能之和。

機器可以看作 $n$ 個節點,第 $i$ 個點電勢為 $h_i \,\mathrm{V}$。

第 $i$ 個點有 $p_i$ 根管道可以從該點通入點電荷,在整個過程中每根管道最多通入一個點電荷,其中從第 $j$ 根管道通入的點電荷會克服外力做 $a_{i,j} \,\mathrm{eV}$ 的功。

第 $i$ 個點有 $q_i$ 根管道可以從該點通出點電荷,在整個過程中每根管道最多通出一個點電荷,其中從第 $j$ 根管道通出的點電荷會克服外力做 $b_{i,j} \,\mathrm{eV}$ 的功。

機器內部有 $m$ 條單向管道相連,第 $i$ 條連接 $u_i$ 和 $v_i$,表示可以將點電荷從 $u_i$ 運到 $v_i$(沒有次數限制),假定機器內其它力不做功,且你可以通過機器操縱每個點電荷的運動軌跡。

每個被通入的點電荷必須被通出,且機器內其它力不做功。即若一個點電荷從 $x$ 點的第 $i$ 根管道進入,從 $y$ 點的第 $j$ 根管道出去,機器對其做的功為 $(h_x-h_y-a_{x,i}-b_{y,j}) \,\mathrm{eV}$。

求最大的動能增加量之和(單位:$\mathrm{eV}$)。

輸入格式

第一行兩個正整數 $n, m$。

接下來一行 $n$ 個整數,第 $i$ 個數為 $h_i$。

接下來 $m$ 行,每行兩個正整數 $u_i, v_i$ 描述一條單向管道。

接下來 $n$ 行,第 $i$ 行第一個正整數 $p_i$,接下來 $p_i$ 個非負整數,第 $j$ 個表示 $a_{i,j}$。

接下來 $n$ 行,第 $i$ 行第一個正整數 $q_i$,接下來 $q_i$ 個非負整數,第 $j$ 個表示 $b_{i,j}$。

輸出格式

輸出一個非負整數表達答案。

範例

輸入格式 1

3 4
3 9 2
1 1
2 3
3 3
3 2
1 2
1 0
1 2
1 1
1 2
1 1

輸出格式 1

6

說明

由於本題的輸入輸出規模較大,額外下發一個 IO 板子。該壓縮包包含五個範例和一個 IO 板子。

資料範圍

對於 $100\%$ 的資料,保證 $1\le u_i, v_i\le n$,$0\le m, p_i, q_i, a_{i,j}, b_{i,j}, h_i$。其中 $a_{i,j}, b_{i,j}, h_i$ 均在對應範圍內等機率隨機,其餘均以某種方式隨機生成,不會針對性卡 spfa 等演算法。

測試點編號 $n\le$ $m\le$ $p_i, q_i\le$ $a_{i,j}, b_{i,j}<$ $h_i<$ 特殊性質
$1, 2$ $50$ $200$ $10$ $10$ $30$
$3, 4$ $70$ $300$ $100$ $100$ $2000$
$5, 6, 7, 8$ $100$ $500$ $200$ $200$ $10^4$
$9, 10$ $2000$ $5000$ $500$ $10^4$ $10^6$ A
$11, 12, 13, 14$ $n-1$ B
$15, 16, 17, 18$ $10^4$ C
$19, 20, 21$ $700$ $5000$ $1000$ $10^6$ $10^8$
$22, 23, 24, 25$ $2000$ $2\times 10^4$ $2000$

特殊性質 A:$|u_i-v_i|=1$

特殊性質 B:$m=n-1, u_i < v_i, v_i=i+1$

特殊性質 C:$\min \{u_i, v_i\} \le 4$

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.