## Contrast SOLUTION AtCoder Contest 178

Contrast SOLUTION Problem Statement Given are two sequences A and B, both of length N. A and B are each sorted in the ascending order. Check if it is possible to reorder the terms of B so that for each i (1≤i≤N) Ai≠Bi holds, and if it is possible, output any of the reorderings that achieve it. Constraints 1≤N≤2×105 1≤Ai,Bi≤N A and B are each sorted in the ascending order.All values in … Read more

## Dist Max SOLUTION AtCoder Contest 178

Dist Max SOLUTION Problem Statement There are N points on the 2D plane, i-th of which is located on (xi,yi). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the Manhattan distance between two points (xi,yi) and (xj,yj) is defined by |xi−xj|+|yi−yj|. Constraints 2≤N≤2×105 1≤xi,yi≤109 All values in input are integers. … Read more

## Redistribution SOLUTIONS AtCoder Contest 178

Redistribution SOLUTION Problem Statement Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to  3, and whose sum is equal to S. The answer can be very large, so output it modulo 109+7.   Constraints 1≤S≤2000 All values in input are integers.   Input Input is given … Read more

## Ubiquity SOLUTION AtCoder Contest 178

Ubiquity SOLUTION Problem Statement How many integer sequences A1,A2,…,AN of length N satisfy all of the following conditions? 0≤Ai≤9 There exists some i such that Ai=0 holds.There exists some i such that Ai=9 holds. The answer can be very large, so output it modulo 109+7. Constraints 1≤N≤106 N is an integer. Input Input is given from Standard Input in the following format: N Output Print the answer modulo 109+7 … Read more

## Product Max SOLUTION AtCoder Contest 178

Product Max SOLUTION Problem Statement Given are integers a,b,c and d. If x and y are integers and a≤x≤b and c≤y≤d hold, what is the maximum possible value of x×y? Constraints −109≤a≤b≤109 −109≤c≤d≤109 All values in input are integers. Input Input is given from Standard Input in the following format: a b c d Output Print the answer. Sample Input 1 Copy 1 2 1 … Read more

## Not SOLUTION AtCoder Contest 178

Not SOLUTION Problem Statement Given is an integer x that is greater than or equal to 0 , and less than or equal to 1 . Output 1 if x is equal to 0 , or 0 if x is equal to 1 . Constraints 0 ≤ x ≤ 1 x is an integer Input … Read more

error: Content is protected !!
+