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

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

Добрый день, Codeforces!

Как-то даже я сам не понял как, но я вдруг взял и подготовил раунд для второго дивизиона. Мне кажется, это подсознание захотело как-то еще смягчить воспоминания о раунде 276.

Я очень надеюсь, что раунд пройдет на ура, как и прошел 277-й — без каких-либо нареканий на работу системы.

Выражаю искренние слова благодарности всем задействованным в подготовке — Максиму Zlobober Ахмедову, Марии Delinur Беловой, Полигону, серверам и Джеймсу Гослингу за Java. Еще я безмерно благодарен тому водителю, который меня всё-таки сегодня не задавил, хотя я, задумавшись о задачах, шел на красный.

Раунд будет рейтинговым, задач будет 6, а разбалловка — неклассической min(500 + i*500, 2500).

Удачи!

UPD.: Раунд передвинут на 5 минут вперед — мне очень хочется, чтобы все, кто хочет принять участие, успели на него. Извините.

UPD 2.: Рейтинг предварительно обновлен. Найдем читеров — применим меры, обновим еще раз. Спасибо за участие!

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

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

6 Problems means that we will enjoy more :) . This announcement made my day :D

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

That's probably my first round from MikeMirzayanov, finally :D

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

Thank You sir :D may Allah keep you in the best of health & happiness always :)

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

So the scores distribution will be with

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

Another sleepless night!

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

6 problems, more chance to enjoy!!!

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

start more and more contests if you can...we need them

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

Раскудрявый клён зелёный – лист резной. Здравствуй, парень, мой хороший, мой родной! Клён зелёный, да клён кудрявый, Да раскудрявый, резной.

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

Вы забыли поблагодарить MikeMirzayanov

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

I believe that codeforces will become more and more perfect. Great thanks to MikeMirzayanov for creating a fine platform,We appreciate everything you do.

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

Тэг "2775" почему-то без точки... будет в будуещем пересекаться с тэгом 2775-ого контеста :|

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

    Это еще не скоро) А преждевременная оптимизация — зло, так что не паримся :)

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

i think next contests will be 277.75 ... :D

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

This time, no thanks to Mike?

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

Mr. MikeMirzayanov I like the way you have made people's handles as their middle names :) that would be quite a nice way to introduce some people in real life :)

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

Mike as the problem setter? I want to take this round now.

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

It 's very interesting !

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

I was laughing something about 10 minutes to this :
"Also I am immensely grateful to the driver, who did not knock down me by car" :D

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

the driver, who did not knock down me by car

Of course , else he would be banned from CodeForces :D

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

6 problems, wow!!!!!!!!!!

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

Неужели никому не интересно, почему раунд 275.5??

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

MikeMirzayanov facts:

277.5) Once upon a time MikeMirzayanov fell asleep on the keyboard and accidentally prepared Div2 contest

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

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

Can't see the register option for this contest. somebody please help fast :(

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

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

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

6 Problems are welcome :D but will it last for 2 hours or more ??

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

Спасибо MikeMirzayanov за сайт Codeforces, удачи всем в этом раунде!

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

Meanwhile in Russia

Cold frost and sunshine: day of wonder!

But I'm on CF. My choice is done)

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

It's wery good that he added the contest, I cant understand why are you joking about this? Everythiing is done for us

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

updated scores will be min(500 + i*500, 2500).

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

hope for some good dp!!!

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

Hoping for a +ve color change.. :) good luck everyone

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

Unsuccessful hacking attempt always killing me! :/

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

Уберите эту ужасную чёрную рамку вокруг фото!

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

UPD.: Раунд передвинут на 5 минут вперед — мне очень хочется, чтобы все кто хочет принять участие успели на него. Извините.

+200 к настроению :)))

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

А хорошие задачки!

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

    Ага! Я бы даже сказал: ностальгические...

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

      А что ностальгического?) Неужели я слишком молод, чтобы это понять?)

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

It was best contest in my life...i saw paging errors just one time...tnks a lot from all of friends who took this contest

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

How was problem F supposed to be solved?

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

    I solved using a dp.

    The states where dp[amount of columns that needs 2 '1'][amount of columns that need 1 '1'].

    The transitions would be picking 2 of these columns (out of all the possible ones) for each row.

    I hope it gets accepted.

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

very nice problem in your contest. thanks MikeMirzayanov

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

strong pretest 0.0

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

Can anyone give me a hint for F ?

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

    I did it in O(N^3) with DP[row][col1][col2], where col1 and col2 is number of columns with 1/2 remaining cells to choose. When you are adding new row, you may either choose 2 columns with 1 cell left and move to DP[row+1][col1-2][col2], choose 2 columns with 2 cells left and move to DP[row+1][col1+2][col2-2], or choose 1 column with 1 and 1 with 2, moving to DP[row+1][col1][col2-1].

    My first implementation was a bit messy and it was challenged, but after adding some prunings it looks fast enough.

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

      Wow !!! Thanks, hope you will get it Accepted. It seems not so hard. In the contest I think about DP[row1][row2][col1][col2], it works fast with std::map but I could not find the correct formula.

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

      You can extract the 3rd parameter from the first two to get O(N ^ 2) solution.

      formula: col2 = ((remainingRows * 2) — col1) / 2;

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

Unfortunately, the website went down in the last 10 minutes of the contest which is the most crucial time! :(

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

How I can solve problem D?

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

    Also wondering

    I tried to enumerate every pair of vertices (B, D) and calculate the number of diamonds (assuming these two are the middle vertices of a diamond). Intersecting their parents and their children, I obtained the number of possible vertices (A, C) that could form a diamond. Also intersecting these two sets, I obtained the number of "repeated" vertices that are both parents and children of A and B, and thus can't form a diamond with itself. And add to the answer the value (parents * children — their intersection).

    But this approach gave TLE

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

    For each possible (end of diamond v; source of diamond u) we can count the number of paths of length 2 from u to v.

    Let us define cnt[v][u] as the number of different paths of length 2 from u to v. We run the following loop:

    1. For x in [1;n] {x is a possible middle point of the diamond}
      • For v in children[x]:
        • For u in parents[x]:
          • If u ≠ v:
            • cnt[v][u] +  + 

    Now we can easily obtain the answer:

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

      Actually now I am not sure why does this solution pass in time.

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

        Won't this work in O(m) ? Provided you store the parents and children of every node before counting. Not sure about this though.

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

          I'm thinking about the test case where we have m / 2 edges incoming to some x and m / 2 edges outgoing from x. Then lines 2-3 are m2, like gen wrote below.

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

        I think that in worst case it will be (m / 2)2, which is fine, 225M.

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

    There's a simple O(N^2) solution (N^2 is an upper bound, actually it is faster I think):

    • For every node i, do a dfs (max depth 2) using i as root

    • During dfs, for every node j that you reach using 2 edges, update cnt[j] (where cnt[j] is the number of ways to reach j using 2 edges) PS: clearly you stop dfs when you use 2 edges

    • At the end of the dfs, iterate from node 1 to N and for every node j update result in this way:

      1. if cnt[j] < 2, do nothing
      1. else: ris += (cnt[j] * (cnt[j]-1))/2 --> This is a "reduct" form of binomial coefficient (I want to consider all rhombs starting to i and ending at j, so I can take all combination of 2 intermediate nodes)

    At the end of the whole process you'll obtain the answer :)

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

How to solve D ? And what is hacking testcase of B ?

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

    I solved D using pascal triangle and a dfs of depth 2 for each node.

    The hacking case on B for me was: 2 2 3 2 2 1

    Some people did not sort the arrays, and the solution like this was enough to pass the pretests.

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

    About D,you can try to use Brute Force. :)

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

Did anyone else experience heavy lag during the contest ?

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

How to solve E?

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

    Let's use binary search to find best possible ratio. When you fixed ratio R, then you know that for total picturesqueness of X you can take no more than R*X total frustration. So for every point you can calculate dist[i] which is equal to best possible difference between F(frustration that you have taken) and R*X. If dist[n] is not positive — it means that you can make ratio no more than R, because you found path with F<=R*X. Otherwise smallest possible ratio is larger than R.

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

      But how to deal with a lot of different picturesquenesses?

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

        When you stay at point X and have dist[X]=D, then you actually don't care about real values of picturesqueness and frustration. Only dist[X] matters — your "frustration reserve". When you move from X to Y — total frustration increases by some value F (cost of this move), and total picturesqueness increases by b[Y], which increases your "frustration limit" by b[Y]*R — it is the same as decrease frustration by b[Y]*R while not changing picturesqueness.

        Part of solution which explains this idea:

        for (int i=0;i<n;i++)
          for (int j=i+1;j<=n;j++)
          {
           double cost=-sqrt(fabs(.0+x[j]-x[i]-L));
           cost+=b[j]*ratio;
           if (best[j]<best[i]+cost)
           {
            best[j]=best[i]+cost;
            par[j]=i;
           }
          }
        
»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I liked F , but I think my solution won't pass. Also very nice E , I don't know how to solve it yet. Congrats Mike for the round !

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

6 unsuccessful submissions to C because I printed "0" instead of "0 0"

Epic Fail(((

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

Problem D reminded me of this Google Code Jam problem !

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

Thanks for the nice problemset! Unfortunately I got overslept for the entire contest. When I woke up, the contest has ended.

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

Could anyone explain me why this algorithm got me WA in pretest 5 (problem D)?

  • Make a DFS from each node with at most 2 iteration.
  • If the distance is 2 add the current node in the rhList of the start node.
  • Sort each list.
  • Count how many pairs of numbers there are in each list (this means that if there are two numbers 2 then there is 1 pair but if there are four numbers 2 then there isn't any pair).
  • The answer is the sum of the results of each list.

Thanks ♥

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

    If you have four numbers 2 in the list, it means there are 4 ways to get to vertex 2 right?

    If that is so, you should pair only these ways (every pair of ways to a vertex will generate a diamond). So you should count how many times each number repeats and calculate the how many pairs you can form with 'count' elements (c*(c-1)/2).

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

I totally overkilled B by using flow =p

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

    OMG!! I was kinda lazy to solve it but I never imagined there will be someone who would do THIS!! XD

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

Solved C using regex'es (8726629).

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

Я уверен, что каждому хоть раз во время контеста приходило подобное письмо.

Часто ли вы скидываете решения? Я вот сегодня, скинул, но я не умею решать задачи, поэтому мой код работает нестабильно, и иногда выводит странное предложение... Какое именно? можно посмотреть здесь : 8734999, 8733233, 8735813

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

    Java заставляет делать очень много кода на ввод-вывод. с++ный cin и cout выглядят куда приятнее.

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

    С временем трюк хитрый! :D

    А вот мне никто не пишет ='(

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

      Большой проблемой было то, что некоторые из серверов КФ показывали время MSK, другие MSK+1 (Можно проверить в запуске). Поэтому пришлось сделать >=22 с рандомом.

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

    troll mode ON :D

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

can anyone explain me why code:

	const int MAX_N=3001;
	bool matrix[MAX_N][MAX_N]={false};

in my compiler makes error "Segmentation fault". (ubuntu x64), but in test system there is no error;

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

    You shouldn't allocate such large arrays on stack. Place it outside the function to make it statically allocated.

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

    In Ubuntu x64 the typical stack limit is 8192KB. You can query and modify it with ulimit -s. However, in Codeforces, stack limit is even larger than memory limit of most problems so stack overflow can't happen at all.

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

In problem E, we have to work with non-integer numbers, so I think we should consider output to be correct if the difference between output and answer is small enough (E.g, lower than 10 - 6)

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

very nice problem in this round,very thanks MikeMirzayanov :)

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

what a shame that you accepted B and C but your code was wrong for A... :(

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

Problem A:

define INF 1000000000 — WA 21

define INF 1000000001 — AC

It's about me. But it was very interesting contest for me.

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

tnx mike it's good conteset but PLZ unlike me :) plz

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

Спасибо за очередной интересный и достаточно стабильный раунд, а следовательно за хорошие впечатления MikeMirzayanov :)

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

Thanks to the ISP , we were cut off the internet country wide for over 9 hours and I missed the contest........in addition, living without internet connection was a wild experience.

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

Is there any way to solve D had the constraints for the same problem were as follows:
1<=N<=2000.
0<=M<=(N*(N-1))/2 instead of 30000 as given in the problem.

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

How to solve D if for the same problem, we modify the constraints as follows:
1<=N<=2000 (Number of intersections)
1<=M<=(N*(N-1))/2 (Number of edges).

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

    You may try N^3/32 solution. Generate bitsets of ingoing and outgoing edges for every vertex. Fix 2 vertices B and D (this gives us N^2), and count number of rhombi for this pair. To count this number, you should count number of valid A's for it (using bitsets of ingoing edges for B and D, you can make it in N/32 by taking blocks of 32 vertices from both bitsets and counting 1's in bitwise AND of these blocks) and number of valid C's for it (same idea, but with outgoing edges). Add the product of received results to the answer, and don't forget to substract invalid rhombi with A==C (to count them you should make same AND trick with all 4 bitsets at the same time).

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

      http://codeforces.com/contest/489/submission/8723815

      2000 0 takes 3.76 seconds (ideone.com).

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

        Of course, when i said "bitsets" — it was not literally about C++ "bitsets":) You implemented solution from editorial, which is even better than my previous idea (it does 4*10^6 bitset intersectings instead of 6*10^6 in my first solution). But it is slow because of bitsets.

        First of all, try your solution in custom invocation here at CF instead of ideone. It shows ~1.2 seconds. That already sounds much better for me:) Implemented a bit more carefully, it works ~0.4 seconds (source code), therefore you should have no problems with using it to solve such problem at CF.

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

          Yes, I've just tried it in custom invocation and I think it would get AC even with C++ bitsets if n<=2000 (MS C++ runtime: 561 ms).

          This was my first solution during the contest, but for n = 3000 it takes 1622 ms :/

          Thanks

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

for problem A why o(n^2) did not give me TLE 8739673 ?

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

    Why do you think it would TLE? n is small (<= 3000), so n^2 is good enough.

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

      i thought n^2 = 3000^2 = 9*10^6 so it require more than one second i think my approach is wrong , so could u simplify it , please ?

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

        9*10^6 operations doesn't take that much time actually, recent processors do around 10^8 in a second, or even more..

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

        You can solve it faster with some data structures (obvious solution with segment tree gives N*logN), but it is an overkill for div2 A.

        Nowadays computers are fast enough to use N^2 for 10000:) And in your solution all operations are very simple, so it will work well even for larger constants.

        Also you can always check speed of your solution in CUSTOM INVOCATION, if you are not sure.

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

        i got got TLE, for i forgot to break in the second loop.. 8727730 But i think in most cases, 3000^2 won`t cause TLE.

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

          I think the complexity of your program is O(n*n*log(n)).

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

          Actually I believe you got TLE because you're printing a lot of data, not because of the time complexity of your algorithm, look at the test case where you get TLE:

          the number of answers you're going to print is "1121253" which is pretty much a lot of data to be printed!

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

            If you print a very large amount of data, then you will get output limit exceeded (OLE) error instead of getting TLE in most of the cases.

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

              I don't know if there is(OLE) here in codeforces, but I tried to submit a code where I just print 1121253 * 2 values, and I still get TLE.

              The Code

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

Спасибо, было интересно!

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

Can Codeforces start the round at 7.00 pm (UTC+4) ? It's too late for me :v

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

Country Wise Rankings have been updated.