CF1815F OH NO1 (-2-3-4)

题目描述

给定整数 $n,m$,一个长度为 $n$ 的非负整数序列 $d$,和 $m$ 个三元组 $(a_i,b_i,c_i)$,保证 $a_i

输入格式

输出格式

说明/提示

In the first test case, the initial weights are $ [0,0,0,0] $ . We have added values as follows: - Added $ 2 $ to vertices $ 1 $ and $ 2 $ - Added $ 1 $ to vertices $ 1 $ and $ 3 $ - Added $ 3 $ to vertices $ 2 $ and $ 3 $ The final weights are $ [3,5,4,0] $ . The output is valid because $ a_1 \neq a_2 $ , $ a_1 \neq a_3 $ , $ a_2 \neq a_3 $ , and that all chosen values are between $ 1 $ and $ 4 $ . In the second test case, the initial weights are $ [0,0,0,0,0] $ . The weights after the operations are $ [12,5,6,7,6] $ . The output is valid because $ a_1 \neq a_2 $ , $ a_1 \neq a_3 $ , $ a_2 \neq a_3 $ , and that $ a_1 \neq a_4 $ , $ a_1 \neq a_5 $ , $ a_4 \neq a_5 $ , and that all chosen values are between $ 1 $ and $ 4 $ . In the third test case, the initial weights are $ [3,4,5,6] $ . The weights after the operations are $ [19,16,17,20] $ , so all final weights are distinct, which means no two adjacent vertices have the same weight.