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

Автор Edvard, 8 лет назад, По-русски

Привет, Codeforces!

27 ноября 2015 года в 18:00 MSK состоится второй учебный раунд Educational Codeforces Round 2 для участников из первого и второго дивизионов.

О формате и деталях проведения учебных раундов я писал уже ранее. Также об учебных раундах вы можете прочитать здесь.

Раунд будет нерейтинговым. Соревнование будет проводиться по немного расширенным правилам ACM ICPC. На решение задач у вас будет два часа. После окончания раунда будет период времени длительностью в один день в течении, которых вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования. Таким образом вы можете локально тестировать решение, которое хотите взломать, или, например, запустить стресс-тест.

Подготовкой раунда занимался я, Эдвард Давтян. Идеи задач были снова придуманы совместно с MikeMirzayanov.

На сегодняшнем раунде вам будет предложено шесть задач. Надеюсь они вам понравятся.

Good luck and have fun!

UPD: Большое спасибо PrinceOfPersia за тестирование задач, а также за Delinur за проверку моего плохого английского.

UPD2: Первая часть соревнования завершена, надеюсь всем понравились задачи. Теперь можете ломать соперников :-)

UPD3: На этапе взломов было выяснено, что верные решения многих участников оказались численно неустойчивы к большим ограничениям. В том, числе решения которые использовали тип double, а не long double ошибаются в ответе в девятом знаке. В связи с этим было принято решения ослабить требования на точность от 10 - 9 до 10 - 6. Вскоре все решения и взломы будут перетестированы. Это никак не повлияет на правильные решения они как и раньше будут получать Accepted.

UPD4: Разбор готов.

UPD5: Раунд закончился. Решения протестированы на дополненном наборе тестов. Результаты окончательные.

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

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

i will invite my friends to this round to improve their skills :D :D

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

hi,how can i hack solutions with generator codes? last contest i tried to hack a solution with generator code but it said invalid input. what should i do?

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

    Your hack is invalid -- and actually, most program outputs are "invalid" in the same way (I'll explain what I mean below). All input and output files must end in a new line character. So if you change cout << "6"; to cout << "6" << endl; in your program, then it would work properly. Technically, all of the output files you produce should also end in a newline character. The reason that you don't get WA is because the checkers ignore whitespace (and are case-insensitive). But it is good practice to include the newline at the end of your programs either way.

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

    when you tryna hack but you get trolled since "#define int long long"

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

      I once did that, got error

      return value of main must be int

      But, if you define the macro inside main, and be careful to define other functions below main, then it will be fine.

»
8 лет назад, # |
Rev. 14   Проголосовать: нравится +20 Проголосовать: не нравится

An opportunity to compete without tension... ~-20

UPD1: (unless you get lots of down votes!) ~-30

UPD2: I wish I could delete my comment:( ~-40

UPD3: TNX the recent few ones who gave me up vote:) ~-30

UPD4: I can't believe this!!! :D ~+5

UPD5: Because of your forgiveness I give every comment an up vote;) ~+20

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

hi again!! 14453627 i tried to hack this. it got accepted but i think it should get time-limit exceeded what do you think?

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

    Maybe you should read comments in the announcing post about this contest? Don't you think you are the first who sent this solution?

    By the way, yes, it's correct solution because of breaks.

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

      (10^5)/2 555555 and then one 6 and then ((10^5)/2)-1 777777 ===> time-limit.order of time is= ((10^5)/2)*(average order for second for = (10^5)/4)=(10^10)/8 ====>time-limit.am i right?

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

Thanks. These rounds are great! But I can't see any editorial :(

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

Will there be a proper editorial this time?

Editorials are the most educational part of any Codeforces round, yet the first educational round had none. That made it less educational for me than regular rounds.

The concept of educational rounds is fantastic and can help us beginners a lot, but it has to be coupled with a strong, thorough, clear and educational editorial.

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

    Unfortunately previous time we have not decided in which format editorial should be. So there are editorial only in Russian. This time I'll write editorial myself. And I'll also translate editorial for the previous round soon.

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

Can these problems have hints for tougher problems in the near future during the contest itself,since these are just unrated contests and meant for learning?

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

    add button "Get hint" (or even different levels of hints)

    if you use it, the accepted solution will get some penalty

    of course, one can use the second account just to unlock and read the hints, but cheating in an unrated round doesn't make any sense

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

      people cheat even in virtual participation.

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

      No matter how hard you try admins won't accept it!

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

        why not? it is easy to implement

        one also could implement the idea that the problem timer starts after you open it (like on tc), and that the hint automatically comes up after you can't solve the problem for half an hour or so :)

        and we just ignore 0.1% cheating contestants since the round is unrated anyway

»
8 лет назад, # |
  Проголосовать: нравится -19 Проголосовать: не нравится

Educational rounds are very good for IOI. I like them!

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

Why are these called educational rounds? For me, all rounds are educational!

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

it's unrated,sad...so i can't join . hahaha

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

I'm new in Codeforces.But,**what is hacks**!?

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

some thing wrong with display times, I am getting 02::min::sec for registration time and 00::min::sec for before contest time please see to it

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

If regular Div 2 contests have the same difficulty as Educational Rounds, it would be fantastic.

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

Я сделал перепосылку, но в таблице штрафа не добавилось. Должно же было? Последнее решение вроде как должно учитываться?

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

I tried to hack a solution with a hack ID = 183673 the jury's solution seems to output 3141592653589793300.0000000000 but the true value is 3141592653589793238.4626433832795 the absolute error is of course much more than 1e-9?!

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

    Relative error is small though. The hack is successful only if both absolute AND relative error exceed 1e-9.

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

      I didn't notice the "or" in the statements and spent the whole contest rewriting the solution in java with BigDecimals -_-

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

Разве это правильный ответ?

Ответ будет считаться корректным, если абсолютная или относительная погрешность не превысит величины 10^(-9)

http://radikal.ru/fp/44fae3c7c9bd49a99465bb4b0c9e387c

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

Can I submit solution in next 24 hours?

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

What does jury solution for D output for the following test?

0 1000000000 1
0 0 1000000000

It seems to me that jury expects 0 as an answer, while it's Pi/2.

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

I have 2 TLE and 3 AC code on E. Why it shows verdict as TLE?

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

На взломах 184717, 184659, 184833 выдается неизвестный вердикт.

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

Rejudge?

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

    See the UPD3.

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

      Не очень понятно зачем было делать перетестирование. Так как это не рейтинговый контест и тем более нужно было учитывать опыт прошлого educational где задача на геометрию не прошла с типом double и сделать выводы перед сегодняшним контестом.

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

      If you can't write a correct solution, you can use mine :).

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

I've sent a submission for D in Java using only BigDecimal with very high precision yet it gets a wrong answer. Are you sure of the judge's answer precision?

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

    I wrote BigDecimal solution too. On test 38 it gives 0.33492209274623239922 while my original solution gives 0.33492209274556042825 and jury solution gives 0.33492207527160644531. It is clearly jury solution that does not have enough precision.

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

    You use doubles in intermediate calculation. Your solution is not precise enough because of that. My fully BigDecimal program gives 0.00188342316684821115 on test 36.

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

    Your solution uses doubles about everywhere, so it is not "BigDecimal with very high precision".

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

I dislike the decision to lower precision requirements. It would be interesting to test different solutions on really hard tests, but now there's no such option.

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

What is the expected solution to the F problem? I have a O(k*m) solution, where k is the maximum degree of a vertex, but this solution doesn't seem like a solution for a codeforces problem.

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

After seeing the last 2 education rounds where many people are having precision issues, I wonder what people's thoughts are about the level of precision required in some problems. It is obviously a trade off, because as a problem setter, you want the precision to be small enough that an approximation algorithm won't work, but on the other side of the coin, does it really add anything to require the precision to be exceptionally small?

As a problem setter, I can tell you that it is hard work to prove that my solution is correct when using floating point precision. I normally end up coding it in Maple with ~500 digits of precision to ensure that my C++ solutions are accurate enough. Personally (as a problem setter), I try to avoid any problem that requires the use of long doubles for the same reason I avoid the use of BigIntegers -- it isn't a level playing field of people who use different languages (and yes, I know, Java has BigDecimal, but most would easily admit that it is a pain to code using it). I'm curious to hear other people's opinion: does it really add anything to contests to ask for precisions of 10 - 9 rather than 10 - 6?

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

 hack owners hacked them selves

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

so them print the right answer with error in ninth sign

Ninth digit. And "they".

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

Why not make Educational Rounds rated for Div 2?

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

Will all the solutions be rejudged after including the Hack test cases?

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

Will this contest have influence on the rating?@v@

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

Hi,

After struggling for a couple of hours to solve problem B I found out something very interesing, the Arrays.sort method with the input from the 20-th test case take more than 2 s ( which clearly is not normal ), after switching to Collections.sort it got Accepted without any problem.

I'am very curious what is the full input for the 20-th test case ( just the first line ) because this really seems as a serious performance issues.

Thanks. Dan.

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

      Cool, this seems like the explaination, thanks!

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

      Well, I believe it's an open question if one wants such tests to be in a fixed test set for the problem. It's perfectly OK for hacks. I always thought that antiqsort should not be in jury tests. But the fact that the standard implementation uses it changes something.

      I'd rather put such tests in training test sets and avoid them in official competitions (probably CF rounds either since someone anyway will hack this).

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

My code is giving correct output for all the small test cases yet giving wrong answer on test 7 id: http://codeforces.com/contest/600/submission/14548282 can someone tell me where i am missing. I have tried to implement STL.

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

Отличный раунд, спасибо! Идея small to large мне вообще была не знакома до этого, хотя сама по себе очень интересная.