Блог пользователя vovuh

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

На этот раз мне нечего сказать, кроме того, что в этом раунде будет 7 различных задач! :)

<almost-copy-pasted-part>

Привет! В Apr/16/2019 17:35 (Moscow time) начнётся Codeforces Round 552 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Наверное, участникам из первого дивизиона они будут совсем не интересны, а для 1600-1899 покажутся простыми. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

Также хочу сказать, что участники, намеренно отправляющие неверные решения и взламывающие их после окончания соревнования (пример), не будут показаны в таблице лидеров по взломам.

</almost-copy-pasted-part>

UPD: Спасибо le.mur за идею одной из задач.

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

UPD3:

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

Место Участник Задач решено Штраф
1 A_Forgotten_Handle 7 229
2 fake_delete_pls2 7 251
3 AntiDHero 6 178
4 Zhao-L 6 222
5 haimiaoyuzhao 6 240

Поздравляем лучших взломщиков:

Место Участник Число взломов
1 wzw19991105 49:-4
2 ScreaMood 42:-1
3 OnlyDeniko 35:-5
4 Hacked_ 31:-1
5 Epitomize 30:-7
Было сделано 949 успешных и 502 неудачных взломов.

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

Задача Участник Штраф
A MonstaKite 0:01
B MonstaKite 0:04
C Chess_fan 0:08
D nikizakr 0:07
E FluffyTT 0:21
F FluffyTT 0:09
G 1tst 0:14

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

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

Expecting this round to be full of awesome questions with strong pretests!!!

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

Every problem you create is nice! Thanks for your efforts, wish you luck, vovuh

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

I can smell an easy and a hard version problem.

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

I will do my best to try to became an expert in this round, I wish high rating to everybody!

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

Hope this contest is balance one like last DIV3.

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

Hope to AK. Fighting

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

The problems of each Div3 rounds are awesome. I believe if one regularly upsolve(solve the problems that one can't solve during contest time) the problems, then (s)he must learn something new and improve gradually.

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

1tst solved 3 problems in 2 minutes !! how that possible ?

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

How to solve problem E?

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

Is it possible to solve problem F without the constraint k is not exceeding 2000?

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

A: That minus just before a+b is not a minus, it is just a dash. Thank you, but that killed the fun for me.

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

    me, me too I pour my 1 hour on that problem

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

      B: Lowest positive Integer is not 1, it is 0. Haha, very funny. C: ans overflows if not defined long long. D: Look like dp, but is not. Really funny.

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

        B: Are you really serious? There is at least 4 places in the statement where is said NON-NEGATIVE value $$$D$$$.

        C: If your calculations are somewhat inaccurate why are you trying to blame us for it?

        D: If you think that the problem topic is DP it is not our fault too.

        And about A: there is a place in the output section where all four numbers are defined without any "dashes" or "minuses".

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

          i still think the dash is confusing and missleading which is exspecially bad for a problem A. (can this still be changed for users who solve this later?)

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

            Okay, I will change this dash to colon. But I still think that users should read statements more carefully.

            Just see the old problems on Codeforces, their statements are so short and many almost obvious things are just not described. But now we are going to explain almost every thing which may be ambiguous. I think that after several hundreds of rounds participants will ask what does "integer" mean or somewhat similar. And it is very upsetting.

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

              But I really enjoyed this contest. Thank you. And for problem A at some point I managed to find out that I was wrong and I got correct answer. I think reading carefully a problem is a part of a problem. I really enjoyed this contest. Than you. Sorry for my bad english

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

              I respect that you have invested a lot of work, and thank you for it. Even though I did not like this one competition, it's still great to have people doing the job.

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

    me too

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

How to solve problem G?

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

I think this is the definition of a perfect Div. 3 contest. All the tasks were well explained, simple to understand and most importantly DOABLE for someone with a rating below 1600. Maybe i say this because i finally managed to solve 5 tasks (lol), but it was a great experience. Looking forward to the editorial, to see how F and G were supposed to be solved.

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

That moment when everyone is thinking how to solve the problems and you are debugging some stupid mistake in your code that has nothing to do with the problem

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

What is the problem in my E solution? I m getting TLE in TC #37 solution: Solution

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

    Got 37 TLE as well at first, but try using next/previous arrays instead of the boolean 'taken'. Where next[i] — the next student after i that isn't taken in any team. (so goes with previous)

    EDIT : With the boolean array, the complexity can come close to O(n^2)

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

vovuh I'm trying to hack problem G and got unexpected verdict while hacking. Hacking id is 550275.

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

    It was because of one of my testing solutions. I was not sure that it is correct and just forgot to tag it as "time limit exceeded or correct". All is ok now, the main solution is fast enough and written without bugs :)

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

can someone please give some hint for problem F and G?

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

Finally!!
Expert :)

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

problem E : Why when the array is sorted the program runs several times longer? I don't understand why.

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

I am very sorry about my bug in the problem G checker. It affected literally two people and just see how it looks:

I'm just TRYING to read two distinct integers $$$i$$$ and $$$j$$$ where $$$i \lt j$$$:

int i = in.readInt(1, n, "i") - 1;
int j = in.readInt(i + 1, n, "j") - 1;

I've tried... Really tried...

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

А каг Ф решать?

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

In problem D:

problem statement said: If the current segment is exposed to sunlight and the robot goes through it using the battery, the charge of the accumulator increases by one (of course, its charge can't become higher than it's maximum capacity).

But it is not said that if the charge of the accumulator exceeds it's maximum capacity, then you can't use battery during sunlight. I thought battery can be used but the charge of accumulator will not increase in this situation, when accumulator has already maximum charge.

vovuh I think you should clarify this in the problem or give a sample input using such situation.

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

unfortunately very weak tests, only 11 tests for problems A B C. Please do more tests in the future.

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

In problem G, I got this in one of test cases
wrong answer Integer parameter [name=j] equals to 557392, violates the range [557393, 1000000]
What does it even mean! Solution link.

UPD: Figured out the error.

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

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

My first CodeForces round ever! I'm really excited, I have also dedicated myself starting today to solve at the very least 3 programming problems daily.

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

The problem A look like -a+b, a+c, b+c and a+b+c before the update

This silenced me for 20 minutes. :<

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

WOW! such strong pretests -_-

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

Thank you guys for this contest. I really enjoyed solving the problems and do think that it was a well balanced contest. :)

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

Weak pretests for B :(

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

    what according to you is a strong pretest?. There were only 5-6 conditions which were needed to be handled

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

      There were three cases in this problem:
      1. Make all the elements equal to ak+d,
      2. Make all the elements equal to ak-d, or
      3. Make all the elements equal to ak.
      for any 1<=k<=n. If we get a constant d(in case of multiple values the smallest one) then it will be the answer otherwise print "-1". My submission gone wrong because I've missed the 3rd case which appears to be one of the basic case.
      5
      4 2 6 2 6
      this test case covers the third case.I think which was missing in the pretests.
      My submission wthout handling 3rd case 52834854 and with handling 3rd case 52891662

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

Is this round rated? system test had finished, why my score isn't update?

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

is it rated?

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

my solution got compilation error during the system test case and when i coped the same solution and resubmitted it i got all correct vovuh please look at this as i lost my rating due to this bug of codeforces my submission link is[submission:52856023]

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -11 Проголосовать: не нравится
Комментарий удален по причине нарушения правил Codeforces
»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

.

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

In problem E Using long long got TLE Using int got AC Why??

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

    This may happen in many problems who have tight time complexity so it is better to use long long int only where it is needed and always use the fast input method. otherwise, in many cases, it becomes very frustrating to find these kinds of mistakes.

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

Hii, I am new to java. Can anyone plz explain why this solution of F is getting TLE on test 66. 52900731

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

Thank you for interesting contest, vovuh, waiting for editorial!

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

Can anyone provide some hint for how to solve G?

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

Problem G is exactly the same problem that has been asked on StackOverflow before. Link

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

    And so what? Did you see fast enough solution to our version of this problem in the link you posted? We have seen this link, but still gave the problem because we haven't found any fast solution in google.

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

How to solve F?

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

    My Approach :

    We need to buy K shovels at lowest possible prices. We will obviously use the K lowest priced shovels. Thus sort the array.
    Now we only need to save the offers (x,y) in which x <= K as we cannot buy more than K shovels.
    Make hash array where hash[i] stores maximum number of free shovels we can get by buying exactly i shovels using one of the offers.
    hash[j] = 0 implies no offer available on purchasing exactly j shovels.
    Now time to apply DP!
    let DP[i] be minimum cost to buy i shovels.
    To calculate DP[i] iterate j = 1 to i, and find min of DP[j-i] + cost to buy j-hash[j] shovels starting from index i. (cumm[i]-cumm[i-j+hash[j]])
    What we are doing is for every i simply apply every offer and check which gives minimum price and store it.
    DP[k] is required answer.
    Link to my solution.

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

      Can you tell me Why picking an offer first and then trying to minimize the cost by using this offer on number of shovels bought is a wrong approach, offers(x,y) are sorted in non-decreasing order of x. Link to code.

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

        Hey
        The ordering of offers is not the correct thing to do.You may have to re use an offer after using some other offer!.
        In fact my first few submissions were using similar approch and was getting WA as well.
        Consider two offers (5,3) and (2,1)
        If we use offer (5,3) before (2,1) for k=8 and A = [1,1,2,3,4,5,6] we get cost as 12 while if we use (2,1) before (5,3) we get cost as 13.
        But for case k=8 and [1,5,5,5,5,7,10] if we use (5,3) before (2,1) we get cost 22 while if we use (2,1) before (5,3) we get cost as 20.
        So we can order the offers as one order may give better value in a few cases but higher values in some cases.

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

Всегда мечтал быть среди победителей в блоге раунда...