codeforces1401专题

Codeforces1401 D. Maximum Distributed Tree(DFS)

You are given a tree that consists of 𝑛 nodes. You should label each of its 𝑛−1 edges with an integer in such way that satisfies the following conditions: each integer must be greater than 0; the p

Codeforces1401 C. Mere Array

You are given an array 𝑎1,𝑎2,…,𝑎𝑛 where all 𝑎𝑖 are integers and greater than 0. In one operation, you can choose two different indices 𝑖 and 𝑗 (1≤𝑖,𝑗≤𝑛). If 𝑔𝑐𝑑(𝑎𝑖,𝑎𝑗) is equal to t

Codeforces1401 B. Ternary Sequence

You are given two sequences 𝑎1,𝑎2,…,𝑎𝑛 and 𝑏1,𝑏2,…,𝑏𝑛. Each element of both sequences is either 0, 1 or 2. The number of elements 0, 1, 2 in the sequence 𝑎 is 𝑥1, 𝑦1, 𝑧1 respectively, and