Binary Cafe solution codeforces

Binary Cafe solution codeforces Once upon a time, Toma found himself in a binary cafe. It is a very popular and unusual place. The cafe offers visitors k� different delicious desserts. The desserts are numbered from 00 to k−1�−1. The cost of the i�-th dessert is 2i2� coins, because it is a binary cafe! Toma is willing to spend no more than n� coins on … Read more

Ski Resort solution codeforces

Ski Resort solution codeforces Dima Vatrushin is a math teacher at school. He was sent on vacation for n� days for his good work. Dima has long dreamed of going to a ski resort, so he wants to allocate several consecutive days and go skiing. Since the vacation requires careful preparation, he will only go for at least k� days. You are … Read more

Wooden Toy Festival solution codeforces

Wooden Toy Festival solution codeforces In a small town, there is a workshop specializing in woodwork. Since the town is small, only three carvers work there. Soon, a wooden toy festival is planned in the town. The workshop employees want to prepare for it. They know that n� people will come to the workshop with a request to make … Read more

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

TubeTube Feed solution codeforces

Mushroom Filippov cooked himself a meal and while having his lunch, he decided to watch a video on TubeTube. He can not spend more than t� seconds for lunch, so he asks you for help with the selection of video. The TubeTube feed is a list of n� videos, indexed from 11 to n�. The i�-th video lasts ai�� seconds and has an entertainment value bi��. Initially, the feed … Read more

Karina and Array solution codeforces

Karina has an array of n� integers a1,a2,a3,…,an�1,�2,�3,…,��. She loves multiplying numbers, so she decided that the beauty of a pair of numbers is their product. And the beauty of an array is the maximum beauty of a pair of adjacent elements in the array. For example, for n=4�=4, a=[3,5,7,4]�=[3,5,7,4], the beauty of the array is maxmax(3⋅53⋅5, 5⋅75⋅7, 7⋅47⋅4) = maxmax(1515, 3535, 2828) = 3535. Karina wants her array to be as beautiful as possible. In order to achieve … Read more