round-for-beginners's blog

By round-for-beginners, 5 years ago, In English

Editorial for #1 Round for Beginners (Div. 4)

$$$A.$$$ Coins for friends

Authors: zhasurr, round-for-beginners

The most optimal solution was $$$n$$$ + $$$1$$$. Perfect can give each friend $$$1$$$ coins and he himself will get $$$1$$$ coin.

(C++) Author's solution:
(Python) Tester's solution:

$$$B.$$$ Road to be Legend

Authors: zhasurr, round-for-beginners, abdu11a

First, take a separate value that will read the lessons and the value that will store the largest. Check yesterday's lesson is the same as today's. If not, then increase the value and the value that stores the longest days will be equal to the maximum of these two values, otherwise the value is equal to $$$1$$$. At the end, check the two values again and print the value that stores the largest

(C++) Author's solution:
(Python) Tester's solution:

$$$C.$$$ Pair of numbers

Authors: zhasurr

If the sum of all numbers in the array is odd, then NO is displayed exactly. Otherwise, take a single number that is equal to $$$sum$$$/$$$2$$$. Sort the array. Now it is exactly guaranteed that the penultimate number and $$$a_i$$$ will be equal to $$$sum$$$/$$$2$$$ or when $$$a_i$$$ + $$$a_{i + 1}$$$ will be equal to $$$sum$$$/$$$2$$$

(C++) Author's solution:
(Python) Tester's solution:

$$$D.$$$ Permutation

The task was taken from the 3rd stage of the Republican Olympiad 2020 (Kazakhstan)

The first number that is odd will jump two steps forward, i.e. the 1st number will become 3 and the 3 will jump the next two numbers and will equal 5. With the even ones everything is the same. For example, the number 2 will be equal to 4, and the 4th to 6, etc.

(C++) Author's solution:
(Python) Tester's solution:

$$$E.$$$ Joyful numbers

Author: round-for-beginners

(C++) Author's solution:
(Python) Tester's solution:

UPD1: Searching for testers to new rounds. If you want to be tester write message to this mail: [email protected]

| Write comment?
»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

python codes plz

»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can someone please clarify problem C? Why is it guaranteed that "the penultimate number and ai will be equal to sum/2 or when ai + ai+1 will be equal to sum/2" when the array is sorted?

  • »
    »
    5 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    example: n = 5; array = 1 3 7 6 5

    sort and get an array 1 3 5 6 7

    loop through the array and check the number with the last element and the next element.

    1. ai = 1; ai+1 = 3; an = 7; need to find if you can get 11 of them? ai + a[i+1] = 4 and ai + an = 8 none of the conditions equals 11 so let's move on
    2. ai = 3; ai+1 = 5; an = 7; ai + a[i+1] = 8 and ai + an = 12 none of the conditions equals 11 so let's move on
    3. ai = 5; ai+1 = 6; an = 7; a[i]+a[i+1] = 11 we got 11 and this pair of numbers is correct.
»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

enjoy this a lot

»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I have no idea why my solution exactly coincides with tester's python solution instead of this that I was not a tester. C A D :)

»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I am not able to see other's code.

»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How can I participate(is it possible?) in a contest like this?