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

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

Привет, Codeforces!

В Jan/11/2019 17:35 (Moscow time) состоится Educational Codeforces Round 58 (Rated for Div. 2).

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

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

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

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Григорий vintage_Vlad_Makeev Резников.

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

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

Место Участник Задач решено Штраф
1 krijgertje 7 182
2 dreamoon_love_AA 7 191
3 KrK 7 196
4 palayutm 7 217
5 TadijaSebez 7 217

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

Место Участник Число взломов
1 _bacali 457:-133
2 MarcosK 252:-6
3 nikit523 129:-6
4 greencis 139:-29
5 djm03178 68:-3
Было сделано 1967 успешных и 1152 неудачных взломов.

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

Задача Участник Штраф
A bazsi700 0:00
B sorry_stefdasca_snsdsux 0:04
C bazsi700 0:07
D ngfam 0:17
E Alif01 0:03
F krijgertje 0:48
G RUSH_D_CAT 0:11

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

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

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

Uhh, can't wait til BledDest, Roms and vovuh finally get rid of their new year colors!

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

Уже 11 января, почему магия ещё работает??

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

awoo has been problem settler over 50 contest, it's even more than number of contests I've ever participated. Where those problems come from?

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

Ctrl A Ctrl C Ctrl V Compile Activated

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

Is PikMike MikeMirzayanov, since PikMike didn't thank him?

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

The worst educational round ever!

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

Так классно давать задачу D, которую сами же давали 7 месяцев назад. Даже условие не изменили толком. https://codeforces.me/contest/990/problem/G

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

    Можешь попробовать отправить решение из разбора, если хочешь.

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

      А я свое по сути старое решение и отправил, я же писал тот раунд. Думаю не один я. Смысл тогда делать этот раунд рейтинговым ? Он показывает уровень скилла ?

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

        У этой задачи есть и другие решения, которые пишутся/модифицируются куда проще центроида.

        Ладно бы мы поставили эту задачу на F или G, тогда бы я был согласен с обвинениями. Но задача с этого раунда сильно проще той, которая была тогда, и мы ожидаем совсем другие решения.

        Если поискать, наверняка можно найти полно задач уровня Div2A-Div2C, которые можно "решить", взяв код какой-нибудь другой задачи уровня Div1C-Div1E и удалив/поменяв его часть. Все раунды с такими задачами должны быть нерейтинговыми?

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

Weak pretests, my solutions passed >:(

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

it's weird if E is that easy :P maybe that's new year gift from santa PikMike or something

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

Almost spent an hour implementing segment trees for E, because I thought "an E-graded problem can't be easier than that, right?". Yes, I'm newer around here.

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

So how do you solve F if binary search + greedy is too slow?

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

How to solve problem G? I could only figure out that the answer must be less than 30.

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

Is it just me? I got TLE in Problem E, this is my solution. https://codeforces.me/contest/1101/submission/48246073

After scratching my head for some minutes, I added

ios_base::sync_with_stdio(false);
cin.tie(NULL);

And voila, it passed.

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

I brainfarted so hard this contest and i am really disappointed of myself... Solved A in 2 minutes then nothing... I didn't know how to solve B even though i think it's really easy (even tried to implement a DP solution) and i thought for one hour and a half that C was asking something else... RIP my rating

F for prayers

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

Does greedy with binary search work for F? I got a TLE on 23rd test.

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

awoo https://codeforces.me/contest/1101/submission/48242640 https://codeforces.me/contest/1101/submission/48241968 the only difference is fast input line i dont think thats how you decide the outcome of a question

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

what can be the test case 4 of problem C ?

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

Well, idk if I was tired or whatever, but B seemed really hard to me, maybe one of the hardest B's ever imo.

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

I had to spend more than an hour solving problem C. That is a very annoying type of problem. I finally solved problem C, but Spending too much time is the cause of trouble. I couldn't submit the Accepted code by a few seconds, so I couldn't solve problem E in the competition. :(

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

How to solve C?

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

Ugh, I saw that F was solved by almost no one so I only decided to read it 10 minutes before the end of the contest, realized that it was really easy and ACed it 5 minutes after contest... RIP rating

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

That moment when E has more AC than C

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

Can anyone help me understand what i did wrong for question c. what i basically did was a brute force approach,checked if a number(point) is occurring in other segments if not i am marking that index and then printing 2 for other segments and 1 for the marked index. my sol is here

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

A better version of problem E would be to find the number of bills inside the wallet for each query.

Solution: Click here

Time Complexiy: O(Nlog^2N)

Space Complexity: O(NlogN).

Any better solution?

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

How to solve D?

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

Why are there so many problems for which the query is given?

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

C condition is very strenge,i have solved the problem where it is asked to divide the set of segments into two sets such that each set does not have overlaps

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

Why does my submission for C fail in tc1 using g++ 11/17 48256069&& gets AC with clang 48258190 ?

Edit : I figured it out i wrote the fast io thing after doing the first cin

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

Problem D Code Can someone please tell what's wrong in this code?

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

Good contest!

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

awoo MikeMirzayanov заметил, что с телефона не могу посмотреть посылки в таблице результатов. В обычных раундах могу, а в educational cf rounds и вроде тренировках не могу(acm style контесты). Update. Как вставить ссылку на профиль. Через значок кодфорсес -> юзер не то добавляется.upd2. Понял. пробелы надо делать.

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

In Problem C, I first Sort the interval according to x and then y. Then I traversed and check while(arr[i].y >= arr[j].x) j++. I put them into same set.Here is my implementation (Link) why it is giving WA??? can anyone give me by giving a useful test case.

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

What are the prerequisites to solve G? And please can anyone suggest relevant resources for the same?

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

а взломы дают очки?

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

I don't see any issue with the amount of the input data in E. It is totally fine to remind you to use faster i/o operations once in a while. My solution works in 300ms and I set TL for 3s. That is so generous that you can even get AC in Python (if you know how to read data fast there).

There is no difference between getting TL because of slow i/o and because of unoptimal solution. And you shouldn't blame author for failing slow solutions.

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

thank for good contest. but why c is difficult than e

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

thanks for good contest .I was surprised to see problem e is easier than b and c.

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

Cheaters Odin- , timo14z On all Problems : D

A: 48219687 , 48218791

B: 48223299 , 48224656

C: 48234891 , 48232754

D: 48239659 , 48241851

E: 48227416 , 48230879

I hope you look into it awoo.

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

How to optimize this solution for F. I used randomization but I have TLE on test 23

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

after doing E got the importance of
ios_base::sync_with_stdio(false);

cin.tie(NULL);

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

What's going on with the hacks on E? Is the hack making the solution TLE because of the slow input?

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

How to solve G

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

please help!!! why my code is showing TLE https://codeforces.me/contest/1101/submission/48260807

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

Do hacks give points??

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

I solved E faster than B.. :/

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

How to solve C?

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

Hi everyone! Could someone help me? I tried to solve problem C, but it gives me TLE and my computer runs the first test case in 31 ms. :( This is my submission.

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

Here's a spoiler for my 60 hacks on E: As already mentioned above, the amount of input is quite large. Though some solutions using endl or alternating cin and cout still passed, reaching ALMOST 3s.

There was also a test where 499999 queries are '?' queries so it was an 'almost-worst case' for such solutions. But it wasn't 'THE worst' case.

I made a generator where the first query is + 1000000000 1000000000 and the rest 499999 queries are ? 1000000000 1000000000. This input not only consists maximum number of characters possible, but also requires maximum number of characters in the output. Then I just went through every AC submissions with time > 2900ms and it worked for all of the 'slow-I/O' codes.

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

Little overkill I made on problem D .. :) I used Centroid Decomposition!!

https://codeforces.me/contest/1101/submission/48257605

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

Im GENIUS!!! Im hacked all people, who solved problem B on PascalABC... INCLUDE ME..IM SUPER GENIUS...!!

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

haha so glad i skipped this one see the people getting hacked off:))))))))))))))=)))))))))

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

Cheaters (Hacks) Mohammad.H915, NeverSee On problem A:

48264141 48264121 and many others

I hope you look into it awoo.

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

How to solve problem D

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

    for all prime numbers less or equal to n find the graph g that all vertices of it are dividable by n (it may not be connected) and find the longest path on it and then the maximum of these values is the answer. this is of course O(n*logn).

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

    You can solve it using modified dfs.
    How?
    Let us iterate i from 2 to sqrt(200000),
     For each i, lets perform dfs:
      We try to reach as much depth as possible which is divisible by i, from the current root (let's say j);
      Let the top 2 maximum depths reached (using 'j' as root) be f and s;
      Thus the longest path can possibly be f+s+1 ( starting from one depth, turning at the root and ending in the other depth).
      So we take the maximum out of all of the above mentioned paths for all roots, for all i.

    Also we need to once run the same dfs given above for each i = a[j]; (where a is given value array and 'j' is the current root).
    This will cover the case in which every number is a prime.
    Thus, the final maximum of length of all the paths will give us the answer.
    Complexity: O(n*sqrt(n))
    Check my submission for more clarity.
    UPD: Thaid Thanks for the hack. Was able to find out the error in my method :). Its updated now .

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

      Consider this test:

      3
      1 7207 7207
      1 2
      1 3
      

      I'm sorry for a hack

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

      It can be done in O(N log N + complexity of prime factorizations) if we consider all prime factors among prime factorizations of values of all vertices. We will create a mapping prime factor -> list of vertices that contain this factor in the prime factorization of their value. Now we iterate over the map and for each prime factor we enable these vertices. Next we iterate over these vertices one more time and if the vertex has not been marked as seen for the current prime before we find the diameter in the tree of currently enabled vertices, rooted at this vertex. The answer is the maximum diameter of a tree we have found in the end. As each vertex only has a maximum of log N prime factors in its factorization, each node is only visited a maximum of log N times.

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

Codeforces should reduce the time for hacking phase.

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

MarcosK is on fire!!! Hacking people like anything!

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

Anyone else solved G greedily and has absolutely no clue why it works?

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

Why there are a lot of hacking in problem A and B?

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

Is it possible to solve problem D by rooting the tree at 1?

I am actually clueless. I am wondering if it is possible or not?

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

SomeOne, please update Ratings.

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

So when can the editorial be released?(And also rating changes?)

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

Why can't rating changes be updated automatically?

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

Why my same solution of B is being accepted now, when it was hacked earlier??

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

Will there be another system test later or it's already finished?

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

how to slove problem C?

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

Where is the rating?

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

Got Problem F Accepted with a small randomization trick + Binary Search.

First of all, I assumed the direct Binary Search would not pass the worst case.

What if we can binary search on each truck and find it's minimum required volume and use that result as low of next truck? Also, I did a check before running the binary search if the previous result can already satisfy the current truck.

A little improvement but now the question arises, would it still pass on some specific type of ordering of the dataset? Surely not and it didn't.

So, I reordered the input order of trucks randomly and ran the same solution which got accepted with pretty fast runtime.

TLE Solution without random ordering

Accepted Solution with random ordering

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

Not using fastio in E causes TLE. I think it should be mentioned in the problem statement to use fastio.

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

    No, it shouldn't.

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

      What should have already happened is system testing. How long more we'll be waiting?

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

      I thought that the TLE verdict is used to imply that your solution does not adhere to the intended time complexity. It doesn't make any sense if the solution adheres to the intended time complexity but still gets TLE because of just fast IO. After all these are algorithmic contests.

      Anyways a learning to always use fast IO on CF! :)

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

        I would be very excited to see competitive programming problems and contests that test only the correctness and complexity of your solution. But, unfortunately, in reality things are just not like that. There are lots of problems where constant optimizations — fast i/o, bit hacks, replacing % with some subtractions/additions in modular arithmetics — really matter. If we don't cover this in our rounds, then participants would not be prepared to use these optimizations on some real contests.

        The reason why we don't mention the requirements on fast i/o in the statements is the same: they are rarely mentioned on official competitions, so participants should be able to determine whether they need to use constant optimizations or not by themselves.

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

          doesnt that defeat the purpose of educationals vs regular rounds

          i mean these are for 'The goal is rather to practice and to educate, than to compete'(as said by MikeMirzayanov), also these are oriented towards second division and newer coders,

          so i think mentioning it in the question would me more motivating for the newer folk rather than them finding out that they had been doing the correct thing from the beginning but just got TLE bcoz of some damned fastio

          btw thanks for replying rationally rather than just some arrogant, "No, it shouldn't."

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

      Well, may I ask why ? In a comment above, you've mentioned "It is totally fine to remind you to use faster i/o operations once in a while". Surely mentioning it in the problem statement is another way to remind ?

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

        well if using fastio can change the verdict of the exact same code then i think it is necessary to mention that

        because fastio is not a differentiating factor when comparing a person who has the right algo, right code, right implementation... with someone with neither of these

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

          "...fastio is not a differentiating factor...".

          I disagree with such proposition. Usually, fastIO is a mistake of newcomers. That's why, it shows your experience in the same way as knowing standart library, math, data structures and other.

          I can replace "fastIO" with "random bug" in your statement and it will sound the same. And that's because solving the problem is not just having idea, but a complex task, and if you fail at least in one part, you will look the same as "someone with neither of these".

          And final thought, if you've got TLE because of slowIO, it means that your implementation is not right. And you can only blame yourself.

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

            imagine this case you are new to programming, you give this question a try, you get the logic and are able to write the code correctly now you submit it and get TLE, you are confused and think that maybe there is some problem with logic and u think and think but couldnt find aany, you get very frustrated and after the contest you realise that a simple fastio line could have gotten you AC you were right all along from the beginning

            how would you feel, would you be excited that you learned about fastio or angry about some fastio ruining your verdict, would this incident be motivating for you to pursue coding further

            what i suggest something like "fastio recommended" in the question of "educational round" and this new programmer learns about it and as well implements it in the first time and gets his code accepted, wont this be more motivating for him

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

              Frustrating is common feeling, everyone in this community felt it many times, and, if newcomer can't deal with it, then it's his personal problem (moreover, frustrating is caused by his own mistakes).

              What he has to do is to get valuable information from it and preform better in the future.

              Ah, and adding "fastio recommended" is bad idea, since almost nobody will learn the lesson. Instead, more people will complain in the future, when they will have to use their own heads.

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

        Meh, learning doesn't work that way. I believe, learning from your mistakes is the most efficient method of learning.

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

          ya, agreed but this is like purposely digging a ditch for someone to fall so that they be careful the next time

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

            Do you think that 500000 queries were just to mess with slow i/o lovers? It was done to guarantee that none of heavily optimized q2 solutions will pass. You can scroll past the previous rounds to see that people were getting n2 AC for n = 105 and some crazy things like that. These low-level compiler optimizations are still black magic to me, so I better ensure it is impossible.

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

            The input has a clear 3 constant, you should be able to recognize this if you're using a slow read method such as cin/cout. Otherwise just go for the printf/scanf. The large input is a consequence of the required constraints of the problem

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

              imagine this case you are new to programming, you give this question a try, you get the logic and are able to write the code correctly now you submit it and get tle, you are confused and think that maybe there is some problem with logic and u think and think but couldnt find aany, you get very frustated and after the contest you realise that a simple fastio line could have gotten you AC you were right all along from the beginning

              how would you feel, would you be excited that you learned about fastio or angry about some fastio ruining your verdict, would this incident be motivating for you to pursue coding further

              what i suggest something like "fastio recommended" in the question of "educational round" and this new programmer learns about it and as well implements it in the first time and gets his code accepted, wont this be more motivating for him

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

                Seems like a good oportunity to get educated enough about fast io to the point where it's unlikely you'll ever forget again

                The suggestion is okay, it's even present from time to time, but it's way different to say suggestion and, textually, "digging a ditch for someone to fall". No, it isn't wrong or required, you're just triggered.

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

      Maybe is shouldn't but it does. Check it out https://codeforces.me/contest/1101/submission/48266295 https://codeforces.me/contest/1101/submission/48234518 2978 ms and 327. Of course second solution got hacked.

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

when will the rating changes come out?

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

include

include <math.h>

using namespace std; typedef long long ll; int main() { int n,i; cin>>n; int maxx=0,maxy=0; for(i=0;i<n;i++) { char c; cin>>c; //cout<<c<<endl; if(c=='+') { int x,y; cin>>x>>y; if(max(x,y)> max(maxx,maxy)) maxx=max(x,y); if(min(x,y)> min(maxx,maxy)) maxy=min(x,y); } if(c=='?') { int h,w; cin>>h>>w; if((h>=maxx&&w>=maxy)||(h>=maxy&&w>=maxx)) cout<<"YES"<<endl; else cout<<"NO"<<endl; } } return 0; }

This is the code of question E, but TLE at test case 7, can anyone explain why TLE is coming?

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

So I've a miraculous solution for G, which I've no idea how it passed. First, I've misread segments into sets, so I thought the elements order does not matter. Second, I couldn't come up with a solution for that version too, but hey, the contest end is so close, so what do we try to do in these cases? Just try out anything without caring a bit about correctness, i.e. think of some greedy/randomized algorithm. I coded a randomized solution, and to my surprise, it passed!

After the contest while discussing the idea with a friend who maybe thought I'm sort of alien to think of a solution like this, I only thought he was surprised due to the randomized solution, but then I was shocked when he asked me, how even the answer for dividing into contiguous segments is the same as the answer for dividing into sets?

I'm still shocked since then, can anyone help me why is this submission AC?! At least is really the answer for dividing into subarrays the same as dividing into segments? Are they not necessarily but most probably the same? And even so, why is randomized solution getting the correct answer with high probability? To be even more shocking, in the randomized solution I just assumed that the difference between the sizes of the largest and smallest piles is at most 1 xD

Anyway, here's a conclusion: never give up on any problem till the last 20 minutes, for that random stupidness can turn out to be equivalent to ultimate intelligence.

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

    never give up on any problem till the last 10 minutes)))
    original (I think) solution of problem G is just coding gauss algorithm in 2-6 minutes
    so keep thinking and generating ideas such as another interpretation of problem at any time of the contest

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

i think system testing will be too slow!

there are about 600!!! tests for problem B

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

500 tests for problem B

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

Can anyone tell me when will the rating be add to my profile? The contest and open hacking have ended, yet the rating has not been added in my profile.

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

When tester got no chill! :p

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

Longest system testing I've ever seen. 600 tests in B lol.

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

Why can't I see all of my submitted codes on My Submission tab

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

Есть кто нибудь у кого B упала на 580+ тесте? =)

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

Question B has highest number of hacks I have seen till date. Thus it also has 600 test cases XD

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

I got TLE on C because i didn't use Fast IO :(( These tests are not ok!

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

What is hack for B?

I can't understand why some greedy solutions get WA. All solutions a kind of let's find the first "[" and the first ": ". Afterwards let's find the last "]" and the last ": " before the last "]". And finally let's calculate number of "|" between ": ". The answer is the number of "|" + 4

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

So sad, the magic already gone :(. I missed my chance to hack "Legendary Grandmaster" :((

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

I don't know how bad luck this is.

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

Post the editorial please.

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

The round of hacks and test cases!

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

With one pass solution, small (500000) constraint and 3 Sec TL why this -https://codeforces.me/contest/1101/submission/48293304) gets TLE without using Fastio.

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

Why this greedy solution for problem G is correct ?This one

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

Hey anyone, can you help me with D? I used a DFS call from current node and the trailing recursion and passed them separate visited arrays, can't get the prime number solution some people are suggesting, any elaborations please? :'(

Here is my code

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

Can somebody find mistake in my code in problem D, please?

https://codeforces.me/contest/1101/submission/48296920

Or can you tell me what is the test 4 in this problem?

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

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

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

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

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

Can someone please explain to me why I got TLE in this submission and when I submitted the same code but after replacing the array of long long "ll ans[200005];" with the array of int "int ans[200005];" in this submission I got Accepted ? It happened to me during the contest and I got hacked on my submission with long long because it got TLE!

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

And I thought I was going to be one of the top hackers with 12 hacks. :P

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

About problem E, is a truly fact that in complexity a solution with or without fast i/o has the same complexity, but this is a programming competition where if you take a look is about problems that has a different behaviour in their running time, is not the same the complexity and the running time, is not the same theory and practice. Programming contest is the practice side.

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

How could guys like _bacali hack so many solutions? I mean, 'top-hackers' need to have special scripts to look through anti-patterns in participants solutions, don`t they?

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

    Yeah, that's true, all that I have to do is to prepare a correct solution of the problem, a test generator which can generate small random test cases, a checker using the "testlib.h" which is used to prepare Codeforces's problems checkers and a well-written script which downloads all the correct submitted codes, compile and run them and compare their result with the output of the correct solution, and when the submission fails on some test it has to be submitted automatically. You can find this script on my Github, so anyone can test it by himself. And it's a good way to warm up your room with your pc xD.

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

_bacali(the best hacker) told me that he write a script to hack.I think its a useful way to find some codes are not right while they passed pretests.I think system should use this to add more tests in main test and find the wrong code which passed the pretests. Sorry for my poor English and poor rating.

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

How the ans for second test case in 2 in Problem D...? Can someone show the path that creates distance 2?
shouldn't the path is 1-3 (2,4) ?
Testcase 2:
3
2 3 4
1 3
2 3

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

Can anyone tell me why my submission for B. Accordion is TLE even though it runs in O(n)? https://codeforces.me/contest/1101/submission/48231331