Lunatic Never Content Solution Codeforces

You have an array a� of n� non-negative integers. Let’s define f(a,x)=[a1modx,a2modx,…,anmodx]�(�,�)=[�1mod�,�2mod�,…,��mod�] for some positive integer x�. Find the biggest x�, such that f(a,x)�(�,�) is a palindrome. Here, amodx�mod� is the remainder of the integer division of a� by x�. An array is a palindrome if it reads the same backward as forward. More formally, an array a� of length n� is a palindrome if for every i� (1≤i≤n1≤�≤�) ai=an−i+1��=��−�+1. Lunatic Never Content Solution Codeforces The first … Read more

Dreaming of Freedom Solution Codeforces

There are n� programmers choosing their favorite algorithm amongst m� different choice options. Before the first round, all m� options are available. In each round, every programmer makes a vote for one of the remaining algorithms. After the round, only the algorithms with the maximum number of votes remain. The voting process ends when there is only one option left. Determine … Read more

Running Miles solution codeforces

There is a street with n� sights, with sight number i� being i� miles from the beginning of the street. Sight number i� has beauty bi��. You want to start your morning jog l� miles and end it r� miles from the beginning of the street. By the time you run, you will see sights you run by (including sights at l� and r� miles from the start). You are interested in … Read more

Walk the Runway Solution Codeforces

A fashion tour consists of m� identical runway shows in different cities. There are n� models willing to participate in the tour, numbered from 11 to n�. People in different cities have different views on the fashion industry, so they rate each model differently. In particular, people in city i� rate model j� with rating ri,j��,�. You are to choose some number of k� models, and their order, let … Read more

Fading into Fog Solution Codeforces

This is an interactive problem. There are n� distinct hidden points with real coordinates on a two-dimensional Euclidean plane. In one query, you can ask some line ax+by+c=0��+��+�=0 and get the projections of all n� points to this line in some order. The given projections are not exact, please read the interaction section for more clarity. Using the minimum number of … Read more