Автор awoo, история, 7 лет назад, По-русски

Привет, Codeforces!

В 24.10.2019 18:05 (Московское время) состоится Educational Codeforces Round 75 (рейтинговый для Див. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

Так же от наших друзей и партнёров из Harbour.Space есть сообщение для вас:

Привет, Codeforces!

Мы хотели бы пригласить вас на курс Михаила MikeMirzayanov Мирзаянова "Advanced Algorithms and Data Structures", который пройдет в Барселоне с 6го по 24е января 2020 года.

Курс будет состоять из 3х недель обучения (5 дней в неделю). Программа включает в себя ежедневные лекции и практические занятия. Это будет познавательно и интересно!

У вас будет шанс познакомиться и пообщаться с Михаилом,который будет рад поделиться своими знаниями и историей создания Codeforces.

Мы рады предложить специальную цену 1,000 евро* для всех пользователей Codeforces.

Регистрируйтесь по ссылке ниже и мы свяжемся с вами! Торопитесь! Всего 10 мест свободны.

* Стоимость не включает проезд или проживание.

Подать заявку→

Мы также хотели бы порекомендовать вам статью, опубликованную в нашем блоге на прошлой неделе о 5 причинах, из-за которых традиционные университеты не могут идти в ногу со временем.

UPD: Начало раунда отложено на 30 минут.

Поздравляем победителей:

Место Участник Задач решено Штраф
1 neal 7 199
2 Anadi 7 205
3 risujiroh 7 208
4 imeimi 7 229
5 jiangly 7 273

Было сделано 96 успешных и 196 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A cxk0707 0:02
B wangziji 0:05
C Bohun 0:06
D guyan 0:16
E1 TwentyOneHundredOrBust 0:15
E2 TwentyOneHundredOrBust 0:14
F Radewoosh 0:19

UPD: Разбор опубликован

  • Проголосовать: нравится
  • +158
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I hope the statement will be clear and simple this time .

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +104 Проголосовать: не нравится

We are happy to offer a special price of 1,000 EUR* for all Codeforces users.

Is it more expensive for Codeforces users than for other people? 1.000 EUR without accomodation and travel. Wow

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Ожидаем традиционно высокий класс Educational раундов, так сказатб.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Can anybody tell me the difference between Educational Codeforces Round XX and Codeforces Round XX? Thanks in advance.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Please try to put an interactive problem.

They are interesting to solve.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think MikeMirzayanov should conduct a Data Structure and Algorithms course in India.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +46 Проголосовать: не нравится

I think MikeMirzayanov should once conduct a course on DSA in India.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Is it just me or nobody can see any top rated users??? not a single user in the page.!

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

delayed!

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

The start of the round is postponed by 30 minutes.


Начало раунда отложено на 30 минут.

»
7 лет назад, скрыть # |
Rev. 5  
Проголосовать: нравится +64 Проголосовать: не нравится

I don't like when contests are delayed

It ruins the organization of our days. 30 minutes is a lot.

But I can understand, if there's an issue with the problems. Better to delay + fix. :/

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +35 Проголосовать: не нравится

I wanted to give the round badly but it looks like I can't :( because I have to catch a train by 23:00 IST. All the best to everyone out there and I wish everyone a high rating :)

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

It's frustrating to wait for another half n hour.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Why delay :/ Now I won't be able to participate.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -11 Проголосовать: не нравится

Delayforces is back 8)

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +29 Проголосовать: не нравится

Hooray! Now i can finish my dinner.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

In fact, I had to go to sleep later because of the contest been put off :( (start at 23:05 here)

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

I think it is better to delay the contest, than to have huge queue time's or unresponsive contest page....

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +24 Проголосовать: не нравится

    let's look at the timeline

    CF has bad performance lately

    everyone is mad about long queue and 504

    13000 registrants for this round, incredibly high

    the lovely pikmisha delays the round

    bunch of people have to go sleep or leave for other things

    less people participating in the round

    this time 504 only lasts for a minute

    coincidence? i think not

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

Вот и повод потратить 1к

»
7 лет назад, скрыть # |
Rev. 5  
Проголосовать: нравится +29 Проголосовать: не нравится

A Bad Day :(

  • »
    »
    7 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +33 Проголосовать: не нравится

    I had a very bad day too. Didn't have a good idea for B & C. That's strange because these days I spend hours practicing on much harder problems. I found D much easier than C. I spent too much time on C and B and couldn't come up with a solution.

    Finally, near to the end of contest, I submitted solutions for B & D and it got Accepted. However, my ranking is currently 1900 something and I would probably get back to blue. It was a really bad day!

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    Well,I think my template of NTT needs changing :(

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I am still unable to solve C in Contest. WTF am I?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve D?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +27 Проголосовать: не нравится

I thought E1 was pretty pointless, it would be better if it was replaced by a task with difficulty between D and E2?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

The questions were really nice they challenged my implementation skills, kudos to the setter

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What was testcase 2 in problem C?

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

Is F solvable without FFT? I know a solution where you need to calculate $$$(1+2 \cdot x)^a \cdot (1 + 2 \cdot x + x^2)^b$$$ or something like that—is it the only way to do it?

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +18 Проголосовать: не нравится

    I solved it using NTT in $$$\mathcal{O}(kn \log{} n)$$$.

    First if we look at coefficient of $$$x^j$$$ in $$$(1 + 2 \cdot x)^a$$$ then it is equal to $$$\binom{a}{j} \cdot 2^j$$$. Similarly coefficient of $$$x^j$$$ in $$$(1 + 2 \cdot x + x^2)^b$$$ is $$$\binom{2 \cdot b}{j}$$$.

    Now it's enough to use one NTT/FFT to evaluate this multiplication. But I think it was possible to get accepted on solution you described.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

What would be the right way to approach E1 or E2?

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +55 Проголосовать: не нравится

    We can approach it in a greedy fashion.

    First of all, consider each voter as a pair (Mi, Pi) and sort all the pairs in ascending order of the Mi values.

    Now lets iterate in the reverse order (i.e from the voter with highest Mi value to the one with the least).

    We want to be sure that we are buying a vote only when its necessary, do be sure of this lets define whats the necessary condition of buying a vote.

    Suppose we are at index i (when iterating backwards), and have purchased cnt votes from the suffix of voters [i + 1, n], and in the worst case scenario we can buy votes from every voter in the prefix [1, i — 1], thus getting a total of i-1 votes from them. So at best we can have (i — 1 + cnt) votes.

    If (i — 1 + cnt) < Mi, we are forced to buy a vote thus this is our necessary condition.

    To buy a vote we can use a minheap which at any index j stores the values Pk for all voters k from j to n, whose vote we have not bought yet. If after checking for the necessary condition to buy a vote at index i, there is a need to buy a vote, we can take the minimum value of Pk from the heap and increment cnt and add this cost to our result, otherwise we keep iterating backwards.

    Implementation of the above idea: 63349135

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится
»
7 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

WA test 2.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C ?? and D, was it binary search ?

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    For C, note that if you divide the number into vectors of odd and even integers, you can see that you will always be able to get any merged sequence of those two vectors. Then just merge as in mergesort. For D, you can just binary search and use greedy.

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +3 Проголосовать: не нравится

    C: Make a vector for even numbers and vector for odd numbers

    Now we can see that the number who will print first is the first number of odd numbers or the first number of even numbers

    And same for the second number.

    Be careful when you use all of odd numbers or all of evens numbers

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

My solution for B that passed the pretests-

Count the number of 1's in all the strings ( let's call it c1) Count the number of 0's in all the strings ( let's call it c2) If c1 and c2 are both odd and there is no string given of odd length — answer is n-1 else answer is n.

Is this correct and if yes can someone please explain why?

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    For B, for the n-1 strings, we can do this - For each of the first n-1 strings, traverse towards the middle and check if it is a palindrome. If there is a change, just swap with the first element of the nth string. This gives you n-1. Now the answer can only be n or n-1. If there is any odd length string, you can do the operation mentioned above keeping that string as the last string and doing stuff to the middle element (instead of the first element). If there is no odd length string, you can get away with parity arguments and show that the answer is n-1.

    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Why is that strategy always optimal though?

      Can't there possibly be some setup where there is no odd string and picking greedily from the last is sub-optimal?

      • »
        »
        »
        »
        7 лет назад, скрыть # ^ |
         
        Проголосовать: нравится +1 Проголосовать: не нравится

        From the strategy given, the answer is either n-1 or n, as in the earlier post. My solution was to check if the last one had an even number of 1s or not. Let us suppose that the last string has an even number of ones. Construct the string from the ends and towards the middle. Let r be the reference to the first element of the first string. If you find a difference, at the left and the right indices, then one of them must be equal to the element at r, wlog, let it be 0. Now since there is an even number of ones in the last string, between the indices left and right (both exclusive) there must be an odd number of both 1s and 0s. So we can swap the element (element at right or left) that was not equal to the element at r with the element at r, and then swap the digit (which was originally at r) found between the indices left and right with the element currently at r. This whole operation keeps the element at r fixed, and also preserves the fact that the substring from 0 to left is the same as the reverse of that from right to size-1. We can keep doing this till left and right are separated by at least 2 elements. If the number of 1s is even, we would end up with 00 or 11 in the end, and this would provide a construction for n. Now suppose that the number of 1s is odd, and there exists a construction where all n strings are palindromes. In that case, every string would have an even number of 1s and even number of 0s because every string is of even length. But this is a contradiction, and hence we are done. The answer is thus < n, and therefore must be n-1.

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +4 Проголосовать: не нравится
    Strategy
    Proof
»
7 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

At a certain time during the contest, there are more people who have solved E2 than that of E1, that's interesting.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve problem B?

»
7 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится -15 Проголосовать: не нравится

solutions for A,B and C

hint for A
hint for C
hint for B
»
7 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится +8 Проголосовать: не нравится

I can't write binary search in a proper manner. $$$Binary\, search$$$ gods, take me.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +46 Проголосовать: не нравится

E is duplicate of a canadian problem: https://dmoj.ca/problem/cco17p5

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

Can any one help me to find the test case where Exactly my code is failing?

Problem A : https://mirror.codeforces.com/contest/1251/submission/63335924

UPDATE:Found The test case :aaakka ->Ans : a

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why are contestants allowed to hack their own submissions? Shouldn't this be disallowed? You should be able to hack anybody else's test case but not your own.

»
7 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится -53 Проголосовать: не нравится
Can someone hack it. It's solution for B.
»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Been scratching my head for over an hour, trying to find out a mistake in my D solution. The idea of my solution is the same as discussed by many in the comments. Got WA on test case 2.

Can someone please help me find it?

My submission: 63336144

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Been scratching my head for over an hour, trying to find out a mistake in my D solution. The idea of my solution is the same as discussed by many in the comments. Got WA on test case 2.

Can someone please help me find it?

My submission: 63336144

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This guy https://mirror.codeforces.com/submissions/amr_abdelazim is hacking his solutions of his own fake account https://mirror.codeforces.com/profile/Amr_Abdelazim01 . He tried very hard to hide the coding style of both account but it is revealed to be same in these 2 solutions https://mirror.codeforces.com/contest/479/submission/59876211

https://mirror.codeforces.com/contest/474/submission/63271187 Kindly look into the matter cheaters like these are ruining the platform.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

In problem D i did not find the function to be monotonic as for many cases I found the function to be discrete.Can anyone help me how there is solution by binary search for such a case.

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +7 Проголосовать: не нравится

    Start with the lowest possible answer. That will be the case, when all the employees get their lowest possible salary, and the median salary will be the median of the list of l of all employees.

    Now try to increase the answer by 1. For the sake of simplicity, imagine that currently, all the employees have distinct salaries.

    CASE 1: Now if the r of employee having salary = median salary is greater than median salary, then you can directly increase that employee's salary by one, and your overall median salary will increase by one.

    CASE 2: Otherwise, let's suppose that the r of the employee having his salary = median salary is itself equal to median salary. In this case, we will try to find an employee whose current salary is less than median salary, but whose r is greater than median salary, then increase that employee's salary to median + 1, so that the overall median salary will increase by one.

    If neither of the above case is possible, then it is just not possible to increase the median salary anymore.

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    Suppose that the maximum median is $$$m$$$, and you sorted employees in ascending order of their given salaries, where the $$$\lceil\dfrac{n}{2}\rceil^{th}$$$ employee is given salary $$$m$$$. To show that you can achieve all the medians down to the lowest one, you will always need to decrease one or more of the salaries of the first $$$\lceil\dfrac{n}{2}\rceil$$$ employees so that their maximum becomes $$$=$$$ the new median. If a new median $$$m_2$$$ can't be obtained because $$$l \gt m_2$$$ for some employee, you can swap him with an employee among the last $$$\lfloor\dfrac{n}{2}\rfloor$$$ employees whose $$$l\leq m_2$$$ (and his $$$r$$$ is obviously $$$\geq m_2$$$ because it is $$$\geq m$$$). If no such employee exists, then there are at least $$$\lceil\dfrac{n}{2}\rceil$$$ employees with $$$l \gt m_2$$$, and the median can't be decreased more.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://mirror.codeforces.com/contest/1251/submission/63338046 https://mirror.codeforces.com/contest/1251/submission/63344390

These are two of my submissions for problem D. The 1st one gave run-time error on test-2 and the 2nd one got accepted. The only difference between these 2 submissions was in cmp() function. (I used > in 2nd one whereas >= in the 1st one)

Can anyone please help me figure out why did 1st one give run-time error whereas the 2nd one got accepted?

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

Help! What does "Unexpected verdict" mean in the verdict of hacks? This verdict comes out at hack #594802.

Does that mean I have hacked the std solution or the validator?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

This guy is just unbelievable see this hacked solution https://mirror.codeforces.com/contest/1251/submission/63344943

He deliberately put the if condition to print 1 so that he can hack his own fake account solution . and see this https://mirror.codeforces.com/submissions/Amr_Abdelazim01

He hacked his fake account solution almost 12 times with different if conditions to print 1. Strict action needs to be taken against users like this https://mirror.codeforces.com/profile/amr_abdelazim

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

These are all the fake accounts that I have discovered so far whom the owner have hacked by putting a if condition to print something nonsense when the input is something specific like if(string=="dfsfdfh45") print("456");

https://mirror.codeforces.com/contest/1251/submission/63335128

https://mirror.codeforces.com/contest/1251/submission/63316807

https://mirror.codeforces.com/contest/1251/submission/63342216

https://mirror.codeforces.com/contest/1251/submission/63341635

https://mirror.codeforces.com/contest/1251/submission/63344050

God people will do anything for the rating . People like these should be banned.

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится -17 Проголосовать: не нравится

.

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится -6 Проголосовать: не нравится

    Is it wrong? Why so many negative votes. Please correct me atleast

    • »
      »
      »
      7 лет назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится 0 Проголосовать: не нравится

      Let the number of strings with odd number of ones and odd number of zeros be $$$a$$$, and the number of strings with odd length be $$$b$$$. Answer is $$$n$$$ if $$$b \geq a\ \%\ 2$$$, else $$$n-1$$$.

      Reason: Only strings with an odd number of both bits can't be made into palindromes by themselves, but two such strings can swap bits to make each other palindromic. That leaves at most one string if we have an odd number of such strings. This string can only swap bits with strings of odd length, which will make the number of both bits even, and hence make the string potentially palindromic. So at most one string can be left potentially non-palindromic if we do not have strings of odd length.

    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится +15 Проголосовать: не нравится

      It is not wrong. Maybe it's too lengthy to read. Also, when a negative vote comes, lot of people just pounce on downvoting. Like when there is one piece of garbage on road, everyone starts throwing the garbage at that place, thinking thats the designated place.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

in problem D why almost all solution use the same formulae in binary search that is mid=(l+r+1)/2 and the low=mid and high=mid-1?? My question is why not they use mid=(l+r)/2 and then low=mid+1 and high=mid-1 based on the condition.. But second give wrong answer..Why?? Pls help Thanks in advance

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

How to solve E1 with DP?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone explain the solution for problem C in easier manner.. Thanks in advance...

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    the order of appearance of even\odd numbers in the sequence will never change because you cannot swap two even\odd numbers so it remains the same. so the easiest way is to make two sequence of even and odd number and every time display the smaller

    Example:-
    
    input : 2531764
    the even sequence : 264
    the odd sequence : 5317
    
    step #1 : we choose the smaller 2 or 5 its 2 "2"
    step #1 : 6 or 5 its 5 "25"
    step #2 : 6 or 3 its 3 "253"
    step #3 : 6 or 1 its 1 "2531"
    step #4 : 6 or 7 its 6 "25316"
    step #5 : 4 or 7 its 4 "253164"
    step #6 : only 7 remains so the answer will be "2531647"
    
»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone please explain the binary search for D with an example, it will be really helpful. Thanks in advance!

  • »
    »
    7 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится -21 Проголосовать: не нравится
    you have to binary search on the median, the range of median is from 1 to 1e9 you will binary search on that, each iteration in the BS you pick the middle and check if it can be the median or not, in-case of yes make the start = middle+1 in-case of no make the end = middle-1 
    

    link to Ac code

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Ok. Looking through the hacks of the round, I've noticed that there are some users who are hacking submissions made by accounts that are clearly their own alt accounts.

Though this isn't a huge deal in Educational Rounds, where hacking is mostly irrelevant, but I think it amounts to cheating in regular rounds, where you get 100 points for a successful hack. Imagine creating 10 accounts, who all submit 5 hackable solutions, and then your main account hacks them all to gain points.

What do you guys think?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

[submission:63342242]why this code has been hacked? [submission:63356037] they have the same code,but the later Accepted.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +12 Проголосовать: не нравится

please publish the editorial

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Where is the solution?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +24 Проголосовать: не нравится

editorial pls

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Please publish editorial

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can anybody please explain to me why this code is giving TLE. (Question C) Link: https://mirror.codeforces.com/contest/1251/submission/63324481

  • »
    »
    7 лет назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится 0 Проголосовать: не нравится

    Use ans += odd[b] instead of ans = ans + odd[b]. For strings always use += to append.

    • »
      »
      »
      7 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Thank You. Can you please explain the reason behind this?

      • »
        »
        »
        »
        7 лет назад, скрыть # ^ |
         
        Проголосовать: нравится +2 Проголосовать: не нравится

        Suppose we have two strings, s and t of and we want to append t to the end of the s. If you write s = s + t what it does is that it creates a new string (that is invisible to you which means you don't have access to it by a variable name but it exists) which holds the resulting concatenated string. To create that invisible string it will copy s and t which basically means it iterates over both of them once which again means the time complexity would be $$$O(|s| + |t|)$$$. On the other hand when you use += it does not need to iterate over s, it just allocates enough amount of memory to append t which is like iterating over t once, with time complexity of $$$O(|t|)$$$. Your TLE solution was $$$O(n^2)$$$ because of the reason that you were basically iterating over ans while appending to it.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится

Will there be an editorial published?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Thanks for fast editorial.

»
7 лет назад, скрыть # |
Rev. 5  
Проголосовать: нравится +1 Проголосовать: не нравится

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

»
7 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится +3 Проголосовать: не нравится

Can someone please help me finding bug in my solution for the problem E2. It's giving WA on test case 3, the test case is really large so I'm not able to find out which input is giving WA.

UPD: Debugged it now

Link to my code

  • »
    »
    7 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Can u explain your idea? pls, thanks in advance.

    • »
      »
      »
      7 лет назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится +3 Проголосовать: не нравится

      We will approach the problem in a greedy fashion.

      • First of all sort the pair vector(input) in increasing order of the number of votes required.

      • Now make a multiset (it's similar to set but it can store multiple elements which are same) which is initially empty.

      • Traverse from the bottom, and one by one push the current element into the multiset. Note that, say if you are at an index $$$i$$$, and the candidate requires minimum votes, $$$M_i$$$ and the cost of buying it is $$$P_i$$$. And you have currently bought a total of $$$v_1$$$ voters.

      • To be sure that by the end of the traversal the current guy will vote us, we need to check if $$$(i — 1 + v_1) \gt = M_i$$$. If the condition is not satisfied, buy the vote of the guy in the starting of the set (cheapest till now), add his cost to your answer and erase this guy from the multiset.

      • Iterate backwards.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

balanced problems, thank you.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Please link the editorial directly to the contest dashboard.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem D has a greedy tag on it. Can anyone please provide a greedy solution?

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

http://mirror.codeforces.com/contest/1251/submission/63422680 can some one tell why this code is giving me tle to problem 3 thanks in advance