You solution codeforces

You solution codeforces You are given a tree with nn nodes. As a reminder, a tree is a connected undirected graph without cycles. Let a1,a2,…,ana1,a2,…,an be a sequence of integers. Perform the following operation exactly nn times: Select an unerased node uu. Assign au:=au:= number of unerased nodes adjacent to uu. Then, erase the node uu along with all edges that have it as an endpoint. For each integer kk from 11 to nn, find the number, modulo 998244353998244353, of different sequences a1,a2,…,ana1,a2,…,an that satisfy … Read more

Diane solution codeforces

Diane solution codeforces You are given an integer nn. Find any string ss of length nn consisting only of English lowercase letters such that each non-empty substring of ss occurs in ss an odd number of times. If there are multiple such strings, output any. It can be shown that such string always exists under the given constraints. A string aa is a substring of a string bb if aa can be obtained from bb by deletion of several … Read more

Mikasa solution codeforces

Mikasa solution codeforces You are given two integers nn and mm. Find the MEXMEX of the sequence n⊕0,n⊕1,…,n⊕mn⊕0,n⊕1,…,n⊕m. Here, ⊕⊕ is the bitwise XOR operator. MEXMEX of the sequence of non-negative integers is the smallest non-negative integer that doesn’t appear in this sequence. For example, MEX(0,1,2,4)=3MEX⁡(0,1,2,4)=3, and MEX(1,2021)=0MEX⁡(1,2021)=0. Input The first line contains a single integer tt (1≤t≤300001≤t≤30000)  — the number of test cases. The first and only line of each test case contains … Read more