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

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

Приветствую сообщество Codeforces!

В воскресенье, 19 октября, в 13:00 MSK состоится очередной раунд для участников обоих дивизионов.

Раунд будет основан на задачах регионального этапа Всероссийской командной олимпиады школьников, который в то же самое время будет проходить в Саратове. Мы знаем о пересечении раунда с этапом открытого кубка, но не можем перенести раунд, так как мы привязаны к олимпиаде.

В подготовке задач принимали участие HolkinPV, gridnevvvit, danilka.pro, Avalanche, IlyaLos, Fefer_Ivan и я.

Разбалловка стандартная: 500-1000-1500-2000-2500 (в обоих дивизионах).

UPD: Опубликован разбор задач.

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

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

Повезло, что не пересекается с Bayan Elimination round

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

I feel and i am sure that this round will be great and interesting :D

However, Unfortunately I wouldn't be able to participate in it because of its timing :\

May be I will try it as a virtual contest later in the evening :D

This might be good for my rating, I have just been a candidate master with only 9 points ;) :D

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

I'm sure that this round will be interesting too. ^^;

good luck for everyone!!

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

I wouldn't be able to participate in it because of its timing too.

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

ICPC rules?

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

Какой-то неполный анонс, даже страшновато. Какие правила? Пять ли задач вообще?

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

    Это будет обычный раунд codeforces для двух дивизионов

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

And I would like to thank MikeMirzayanov and Codeforces team for this fabulous platform. :)

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

Жаль что пересекается с opencup :(

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

Maybe a little off topic, but due to the timing I'm really hoping for a 3-0 SSW sweep at world finals.

Context

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

a Russia's contest again !!!
Nerevar,thank you !!! your last contest had good problem :)

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

OPPS! I have to miss this contest. Unfortunately it will be at my EXAM time.

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

My first Div. 1 contest!! :)

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

"To wake up at 5 am, or to stay up until 5 am, that is the question!" -Hamlet, adapted

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

раунд будет рейтинговый?

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

    Это будет обычный раунд codeforces для двух дивизионов

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

The comment is hidden because of too negative feedback, click here to view it

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

I have registered but how to watch the questions?I am unable to get it last time when I entered.Where should I check for the question at the contest time?Please help me.

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

Good luck to every one!!! Its time to coding! Just believe! You can increase your rating! All of we can be grandmaster just we must trust! We must practice! We must start to solve difficult question! If we try to solve more difficult question solving question A B C will be easy! Sorry for my pure English. I wont to give some motivation sentence. Indeed person is able to do every thing. Just we must believe us.

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

    Sorry for my pure English

    I forgive :D

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

    Pure means perfect. I think you misuse it. May be you wanted to say Sorry for my bad/poor English. BTW never mind :) We should learn from our mistakes :)

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

i am new on codeforces and i am lovin it

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

Thanks perfect time for me, hopefully for some others also. More contests at the same time please ;-)

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

    And I problems were also interesting, great contest today. I had a little problem to understand C today, but that's my problem only...

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

It's 5PM now in China, and I'm quite hungry now..

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

Интересненько будет поучаствовать...

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

Wrong answer in B problem — Div 2. For the third example the answer should be 3 2, not 3 3: 8-3-2-6-3 1)7-3-3-6-3 2)6-4-3-6-3

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

    There's no requirement that the number of operations used is minimum.

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

    This problem took me 20 minutes. I misunderstood it. I thought like you that the second number should be minimal. And then I saw this example... . It took me far more time to see that second number shouldn't be minimal.

»
10 лет назад, # |
  Проголосовать: нравится -47 Проголосовать: не нравится
Комментарий удален по причине нарушения правил Codeforces
»
10 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Good bye yellow color!

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

Can't understand how to crack another participant's submissions. no button, no link...

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

    You have to lock your problem first on the Dashboard page. Only then can you hack other solutions.

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

Why wasn't I able to copy-paste my hacking input(that I had generated seperately) to hack another solution ?

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

So the intended solution of C Div1 was an O(n^2) DP?

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

    i think it is, cuz my solution with segment tree was hacked

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

    My solution is O(nk), but yes, it's DP.

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

      Sorry, I meant O(nk), anyway, k is O(n). Thank you for reply.

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

      can u tell how to do it ... my solution was n^3 dp .

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

        Just recalculate sequence of its partial sums sum[] on each iteration.

        a[i][l]+a[i][l+1]+...+a[i][r-1]+a[i][r] = sum[r]-sum[l-1]

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

        I'll see whether my solution passes or not, but basically I compute the number of ways to end up on floor i after j steps for all possible i, for j = 1, 2, ..., k. Or more precisely:

        • Convert the buildings stuff so that the secret lab is on floor  - 1. We start on floor a' - 1 and the maximum height is on floor n' - 1. (In my solution above, I used that the secret lab is on floor 0, we start on floor a', and maximum height is floor n'; this made the array 1-based which is hard, so you can see a couple of places mentioning a-1 and never only a.)
        • Create a DP array of n' elements, indicating the possible number of ways to go to i-th floor after k steps. (This is array last and next; I only use the last row to construct the next row, hence why only two arrays and not a two-dimensional array.) At first, last[a' - 1] = 1 and last[i] = 0 otherwise for step k = 0.
        • Each iteration, compute next[i]; this is the sum last[i / 2 + 1] + last[i / 2 + 2] + ... + last[n' - 1], since we can go to floor i from floors i / 2 + 1, i / 2 + 2, ..., n' - 1. Subtract this with last[i], since we may not stay in the same floor. After all n' elements, replace the elements of last with the corresponding elements of next. To do this efficiently (O(n) instead of O(n2) each iteration), begin by taking and let next[i] = sum - last[i]; also, every time i is odd, subtract last[i / 2] from sum. All divisions are taken to be integer divisions. Remember to use modulo.
        • Iterate k times. The answer is the sum of last[i] after k iterations, of course after modulo.
  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Well I think so, pretty sure that there is no soln in less than O(nk) and O(nk) surely exists.

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

What is the solution for Div 1 A?

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

    I just sorted them in descending order by a[i]. Have a variable that keeps track of the current day, let's name it day. Starting case is day = b[0] (zero indexed, already sorted) Now for all elements (starting from the second):

    if b[i]>day, day=b[i]

    else if b[i]<day, day=a[i]

    Just print day at the end. It's a simple O(NlogN) solution that I believe works (hasn't been hacked, can't know for sure before grading).

    EDIT: Forgot about the sorting when mentioning complexity.

    Here's my solution

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

What is the Hacking testcase for C ?

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится
    3
    3 2
    4 1
    6 5
    

    Many people assumed that when the pairs are sorted by a, the resulting permutation of b must also be sorted in order for the answer to be bn (otherwise an). This is not the case, as shown by the test case above. (The answer is 5; many people give 6.)

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

      Also, another good hack is:

      4
      5 4
      5 3
      5 2
      5 1
      

      I managed to hack 2 solutions with this test (probably the ones which worked on your test above). Solutions which only sorted by a will fail on this test.

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

A guy in this room reaaallly wanted to hack the room leader's solution...

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

As always, unrated coders take over: 3 out of top 5 in Div2 are unrated

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

What were the hacking test cases for B div. 1? I found only one more or less common mistake — not checking whether the additional labels belong to [0 , L] interval.

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

    Well, my solution didn't pass pretests when I wasn't checking if new added dot < L, so maybe it's only the left if it's positive

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

    I found this (which also failed my locked submission):

    6 20 14 15
    0 9 10 16 17 20
    

    Some people that made searching whether a distance exists in the array made it a function and thus only returned the first occurrence. In this case, the first occurrence of y - x is (9, 10), and with bounds they go over the ruler. However, there is another occurrence (16, 17), which fits; a new mark can go to 2, so the answer is 1 new mark. Those unlucky people (read: me and a couple I hacked) answered 2.

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

      wow, that's unreal. This got me too

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

      can u tell why my solution was hacked.... on your test case as well i am getting 1 2 as the ans . http://codeforces.com/contest/480/submission/8311510

      i will try to explain my approach . first find if any of x or y exists or not . if they both exist than output 0 if only one exist than output the other one if none exist than starting from every point find arr[i]-x,arr[i]+x,arr[i]-y,arr[i]+y keeping in mind about the overflow. if any of them occurs twice than output that coordinate else output given x and y. did i miss any case ??

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

      well ..., next time will be because my D solution is broken with this case.

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

    My solution had the problem that I was introducing only the new values of arr[i]+x or arr[i]+y. A case like

    3 9 1 4
    0 6 9
    

    would fail.

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

The Constraints of div1A were misleading :\ Made it look like an O(n^2) solution was the best when O(nlogn) is the most common solution.

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

How to solve Div 2 B?

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

    You can just take k times,in each time you work for the maxium-1 and the minium+1,notes the ans. And then it'll be solved:)

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

How do we solve the problem D (div2)?

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

    Solution can be 0,1 or 2(its obvious). Now, you can check if answer is 0(There exists both x and y). After, you can check if you can add a dot somewhere and make both x and y. If you cannot, just print 2 x y. Time Complexity: O(NlogN) logN is for using map/set/binarysearch. Space Complexity: O(N)

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

То чувство, когда копипастил код в задаче Б и забыл поменять один плюс на минус :(

АПД: То чувство, когда понял, что этот случай никогда не реализуется на практике :)

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

why haven't the system tests started?

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

TESTINGTASK asked me during the contest for soln of Div2 C,stating " I'm new to codeforces and im struggling a lot. Can you tell me your solution to task C? ". Please "BAN" this guy!

Edit : Image Attached [Image Link]

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

Уважаемые организаторы! а можно добавить такую фичу: после конца раунда удалять из списка зарегистрировавшихся людей на раунд тех, кто не сделал посылок. В этом случае можно можно будет примерно прикинуть свое "ожидаемое место" для расчета рейтинга и понять, как ориентировочно измениться рейтинг, что сохранить нервы участников)) особенно в случае такого долгого ожидания тестирования, как сегодня... + это просто реализуется и не требует больших временных затрат

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

It's already 15:30,but why didn't the testing happen?:)

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

it's already 15:40 :(

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

On problem D on Div.1, I think O(Sn^2) solution is easy but doesn't pass, but someone said it will pass.

If it will pass, what a sad...

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

Has the olympiad ended? Can you publish an editorial?

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

nice

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

finally system testing has started!

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

What about Div. 2 problem E? I thought of a O(n^2) dp solution though sadly the contest had ended by then.

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

Why is gcd(185,230) not a valid answer for pretest 1? please help in Problem-D Long Jumps Div2!!! We can measure in multiples of 5. What's the problem with that?

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

    answer can be 0, 1 or 2. Re-read the statement.

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

    It's not a valid answer because it doesn't use the minimum number of marks.

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

      The number of marks is 1 only but the value is 5.

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

        Oh, I misread; I thought you meant there are marks.

        Reread the problem statement; you may not move the ruler while measuring the distance. In other words, the distance must be exactly the distance between some two marks, not the sum of several such distances. If you measure with the GCD, you need to move the ruler to construct the distance 185 and 230, which is not permitted.

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

What about problem E of div. 2? I thought of a O(n^2) solution, though sadly after the contest.

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

Интересные задачи, спасибо организаторам за прятно проведенное время :)

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

Excuse me, I open CF website very slow on chrome, even can't see other people's codes after locking my problem B (I double click on other's scores of problem B in my room, but nothing happened). But it works well and very fast on IE. Can anyone tell me what will be the reason?

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

Can someone help me to understand this?

scoeretable

I solved C at 0:47, so I should have less points than wzyjerry. I missed somthing?

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

    Might be he had wrong attempts.

    EDIT : Indeed. He made a re-submission to the problem. Check his submissions.

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

      Ok, but I cannot see those in history for C (not sure if it should be there or not), he had both hack attempts for C.

      EDIT: you were correct, I didn't know what state "skipped" is

      detail

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

    -50 for failed attempt.

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

    the person mentioned might have had a WA/TLE on a previous solution, thus reducing 50 points from what they should have got.

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

This test #11 for DIV2, problem D is a killer :-D

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

Longest System test ever !!

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

Anybody can explain me why Bailando's 8304577 Div2 B problem works in 61 ms with this code:

rep(i,1,k) {
		sort(a+1,a+n+1,cmp);
		a[1].x++;a[n].x--;q[i].y=a[1].id;q[i].x=a[n].id;
		sort(a+1,a+n+1,cmp);
		ans[i]=a[n].x-a[1].x;
	}

2*k times sort n elements!

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

why is the system test taking too much time :/ ?? thats weird

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

why is the system tes taking too much time ???n thats weird !! :/

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

    It seems there is 111 tests for problem DIV2 D...

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

    There were a lot of successful hacking attempts today. So number of final tests is also very large.

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

    More than half of our judging machines were switched off from Codeforces because we need them on High-School Contest and Saratov ACM-ICPC Subregionals Contest.

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

I thought this contest was going to clash with codechef's. I missed it. :(

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

Any hint with DIV-2 E ?

Thanks in advance

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

    DP

    It was asked here before...

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

    Make DP in O(n3) and add presum for make it O(n2).

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

    A simple DP solution in O(n2k):
    Let dp[i][j] — number of sequences of length j which end with number i.
    Then it's easy to make forward DP propagation:
    dp[t][j + 1] += dp[i][j] for all t reachable from i.
    We can also notice that all ts for some i form a subsegment (or two), so we can use something similar to partial (cumulative) sums in order to achieve O(nk) time.

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

(time zones in EST) Contest duration: 5:00 — 7:00 Addition of Hacks to System tests: 7:00 — 7:45 System Tests: 7:45 — past 10:15 Rating Addition: past 10:15 — ???

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

Russia School Competition pwned Codeforces Testing System's head for 254 gold !

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

А когда начнется тестирование задач с дорешки?

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

Div2 Rating Changes posted but Div1 has not been updated yet.

Back to purple again! :)

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

These are two of my submissions, 8318803 and 8319108, the only difference between them is that in the first one I have used a macro at one place and in the second submission I havent used a macro at that single place. The observation is that when I didnt use a macro, the solution got faster by 31ms, so does a macro slow down a solution to that extent?

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

    A macro is only processed by the compiler's preprocessor, so it won't affect your runtime. This is just a result of inconsistent judging.

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

Looks like my prayers for red were answered. 2201!!

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

Very weak tests for Div 1. A!

The solution before I submitted, which is wrong:

http://codeforces.com/contest/480/submission/8322271

gets AC.

My correct solution (http://codeforces.com/contest/480/submission/8307803) also gets AC... but it seems I shouldn't have resubmitted D:.

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

    That else block will never occur. Read the problem statement again; the first element will always be greater than the second element, so dead[g].first >= last will always be true.

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

Need some help in Div 2 C or Div 1 A 479C - Exams. This submission 8310177 got WA for test 18 while this submission 8322341 got AC. Both codes are similar- the first one uses an array and the second one uses STL pair. Can someone please explain what went wrong in the first one. Thanks in advance.

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

    Sort stinks. Try sorting with cmp1 first, then with cmp. But I'd rather write all this into one comparator.

    if(x.a<y.a) return 1; else if(x.a==y.a) return x.b<y.b; return 0;

    Try.