## Heights and Pairs SOLUTION ACL CONTEST

Heights and Pairs SOLUTION Problem Statement There are 2N people numbered 1 through 2N. The height of Person i is hi.How many ways are there to make N pairs of people such that the following conditions are satisfied? Compute the answer modulo 998,244,353.   Each person is contained in exactly one pair. For each pair, the heights of the two people in the pair are different. … Read more

## Replace Digits SOLUTION ACL CONTEST

Replace Digits SOLUTION Problem Statement You have a string S of length N. Initially, all characters in S are 1s.You will perform queries  Q times. In the i-th query, you are given two integers Li,Ri and a character Di (which is a digit). Then, you must replace all characters from the Li-th to the Ri-th (inclusive) with  Di.After each query, read the string S as a decimal integer, and print … Read more

## Flat Subsequence SOLUTION ACL CONTEST

Flat Subsequence SOLUTION Problem Statement You are given a sequence A1,A2,…,AN and an integer K.Print the maximum possible length of a sequence B that satisfies the following conditions:B is a (not necessarily continuous) subsequence of A.For each pair of adjacents elements of B, the absolute difference of the elements is at most K Constraints 1 … Read more

## Connect Cities SOLUTION ACL CONTEST

Connect Cities SOLUTION Problem Statement There are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M. Road i connects City Ai and City Bi Snuke can perform the following operation zero or more time Choose two distinct cities that are not directly connected by a road, and build a new … Read more

## Integer Preference SOLUTION ACL CONTEST

Integer Preference SOLUTION Problem Statement Snuke likes integers that are greater than or equal to  A , and less than or equal to  B . Takahashi likes integers that are greater than or equal to  C , and less than or equal to  D .   Does there exist an integer liked by both people? … Read more