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

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

Всем привет! Я рад пригласить всех Вас поучаствовать в Codeforces Round 574 (Div. 2), который пройдет в 17.07.2019 17:35 (Московское время).

Этот раунд основан на командной олимпиаде ЛКШ. Вам будет предложено 6 задач и 2 часа на их решение. Этот раунд будет рейтинговым для участников из второго дивизиона. Другими словами, раунд будет рейтинговым для участников с рейтингом меньше 2100. Как обычно, участники из первого дивизиона приглашаются поучаствовать в соревновании.

Задачи были придуманы и приготовлены budalnik, Kurpilyansky, meshanya, tsarn, sava-cska, ima_ima_go и craborac. Я являюсь просто координатором этого раунда и сделал небольшую часть работы, такую, как переводы на английский и разборы. Я хочу поблагодарить Михаила MikeMirzayanov Мирзаянова за прекрасные системы Codeforces и Polygon, всех авторов этого прекрасного раунда, KAN и cdkrot за помощь в оценке сложности и выборе задач, а также моего хорошего друга Ивана BledDest Андросова за помощь в подготовке раунда!

Удачи и только зеленых сообщений во время системного тестирования! :)

UPD: Разбалловка 500 — 1000 — 1500 — (1000+1500) — 3000 — 3500.

UPD2: Я хотел бы поблагодарить тестеров galloska, NatInTheHat и AlexPop28 за помощь и советы по поводу раунда!

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

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

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

It is usually a good contest if vovuh is a coordinator. Good luck

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

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

Why some people participate out of competition even though their raiting is < 2100?

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

I hope to become cyan again.

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

I hope to become white after this contest.

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

I hope to become blue finally. :D

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

I see people hoping to improve their colors (ratings). But I hope to have no WS, more ACs and a lot of fun :)

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

Clashes with topcoder SRM 763!

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

Some codeforces round will delay the start.I hope this round will not be like this.

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

I'm noob so i wanna know what's the difference between div 2 and div 1 :D thanks

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

I'm sorry that I can take place.

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

If i can solve Div 2 A,B,C regularly,can i ever become a specialist?

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

What is SIS contest?

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

What does it mean to coordinate a round ? What does the coordinator do ?

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

Will the pretests of problems in this contest be strong, like those in Educational Codeforces Round 68?

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

What will scoring distribution be like?

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

Please let me see my repay! ->Codeforces Round #574 (Div. 2)

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

This round clashes with Codeforces Round #574.

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

i will be cyan today....waiting for div3 vovuh (^.^)

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

Не слишком ли жестко задачи на 3000-3500 для Div. 2?

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

What is SIS team contest ?? Can't find any relevant info about it on dd

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

500 — 1000 — 1500 — (1000+1500) — 30003500

Is it even div.2 ???

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

GOOd luc to all ! .. xd hope rating get

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

No Hackforces or Queueforces please!

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

Gray here I come!

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

Sorry to say, but A is much to much text. That is not very motivating.

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

Nobody :

Me:

(5 mins before the contest): watching hunter_x_hunter

(contest begins) : reading problem-A...

(5 mins in contest) : still reading problem-A......

(10 mins in contest) : (yawning) still reading-A.........

(15 mins in contest) : watching hunter_x_hunter again

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

Спасибо за хороший контест и интересные задачки (нет, это был очередной контест, где надо мало думать и много писать :(( )

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

is there someone else too or only me.

till 20 min reading problem a.

solved b in 5.

again reading a for another 10.

solved c .

again reading a.

solved d1.

now still reading a...

basically A ruined my mood .. :( .. what the question is saying. at one moment i thought of shut down and play pubg but b c d1 were easy ...

&& also share approaches for d2 and e after the contest.

Thanks.

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

I think D2 worth more points. D1:750 D2:1750 would be better.

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

F: another problem that Wikipedia makes a difference

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

    So it means we can reduce the problem to querying the number of different directions of the directed arrows in a certain range. Didn't figure out this until the last minute of the contest.

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

Woah, how to solve E? Is it some observation on the recurrence, or simply data structures? :O

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

Задача, аналогичная E: https://acmp.ru/index.asp?main=task&id_task=1177

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

For E, why doesn't a segtree solution pass?

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

Can anyone share how to solve D1? I bruteforced it and got tle in tc7.

Also A took me so much time to solve like 3*(time req for B). It was really demotivating :(

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

Так, так , так , что тут у нас. Раунд на силу + баяны с Б' + набор оригинальных ( нет) задач ? Да, вы правы. Спасибо составителям задач за раунд. Можно больше не проводить зеркало командной ЛКШ олимпиады. Или делать его не рейтинговым ....

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

How to solve D2 ?

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

    For $$$f(x, a)$$$ and $$$f(x, b)$$$, if $$$a$$$ and $$$b$$$ have the same number of digits, the effect of $$$x$$$ on the answer is always the same. The same holds for $$$f(a, x)$$$ and $$$f(b, x)$$$. In addition, if $$$a$$$ has at least the same amount of digit as $$$x$$$, the effect of $$$x$$$ on answer is always the same. We only need to store the frequency of number of digits.

    The contribution of $$$x$$$ would be like follows (take $$$x=1234567$$$):

    $$$12345670 - \gt 123456070 - \gt 1234506070 - \gt ... - \gt 10203040506070$$$ if it is $$$f(x, a)$$$.

    $$$1234567 - \gt 12345607 - \gt 123450607 - \gt ... - \gt 1020304050607$$$ if it is $$$f(a, x)$$$.

    $$$a$$$ has number of digits $$$1 - \gt 2 - \gt ... - \gt numberOfDigitsOfx$$$.

    To insert a zero between the digits, you can just use the *, /, % operators.

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

Problem D: So the digit combining function helped the students find the coordinates of the treasure?

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

Where am i wrong.Can someone please help? For C problem https://mirror.codeforces.com/contest/1195/submission/57227259

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

Why didn't you send a single announcement that you updated problem B statement? I didn't refresh and wasted a lot of time with it.

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

Оригинальные™ задачи (Задача E (https://archive.lksh.ru/2018/winter/B'/statements/04.pdf))

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

    Лол, оказывается, я эту задачу уже сдавал(во время контеста я ее, конечно же, не решил)

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

    Где можно найти решения этих задач?

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

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

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

Nice round! I solved two problem but didn't have idea of problem C. Does someone teach me how to do?

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

I'm so sad if just 3 minutes I could've solved D2 ugh stupid bug lost 30 more rate

Edit : it was WA lol I'll never assume my solution is right unless I see the fukin accepted

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

3000 за минимум в окне, кто даст больше?!??!?!!

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

After lot of searching, I found problem C at https://www.geeksforgeeks.org/maximum-sum-from-three-arrays-such-that-picking-elements-consecutively-from-same-is-not-allowed/ only to find out the code does't give correct output on pretest 2. Tried to fix it, failed.

RIP rating.

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

meme

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

Very good round!! First round to solve 4 problems. I usually solved 2 or 3

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

Is it possible to solve B mathematically? To solve this system of equations: 1. x(x + 1)/2 - y = k 2. x + y = n which gives y^2 - y(2n + 3) + n^2 + n - 2k = 0 and solve this quadratic equation for y. Then, check whether y fits [0, n]. It fails on the 11th test, what have I done wrong?

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

can someone explain the first sample in D1 please ?!

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

Lucky me.

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

Problem F,why the sample input different with the image.

3
2 2
1 2
2 1

but the image is:


------- | / | / | / | / |/

why??????

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

Here is an interesting approach for problems like today's E. It provides an $$$O(n)$$$ solution to the minimum element on all subarrays of length k problem

Link

Do this for every row with a sliding window (two pointers) of length b, and then with these results do it again for every column with a sliding window of length a (or vice-versa)

I tried it using a map, but it seems $$$O(n\cdot m\cdot logn)$$$ is too much this time :(

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

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

If I submit two correct solutions in different time, which one is scored? Latest one or first one? I miss submit D2 solution to D1...

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

Why is the TL of E so tight? Even O(n * m * log(m)) solution is not passing the time limit :(

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

Wow, another ImplementationForces round, so cool (yes!)

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

In round #574 (div 2), problem D1 I had submitted my solution with 10-20 seconds remaining and it was in the queue for verdict but suddenly the contest was over and I was redirected to the home page of contest. Please look into the problem.

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

editorial?

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

Idea for the problem D1?

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

    Observe that for each digit of each number, you can predict what position it would occupy in the functional output. For ex., if the numbers are 22 34 then f(22,34) = 2324 and f(34,22) = 3242. So, the ith digit in, say, x would be the 2*ith or the (2*i + 1)th digit in the functional output. So, simply iterate over the 10's expansion of each number and add to an ans variable the value that each digit in the expansion would occupy in the output.

    To complete the example above, you'd have s=(4*(10^0)+4*(10^1))+(3*(10^0)+3*(10^1)) from 34 for each number it is going to be paired with. Each number will be paired with n numbers (including itself), so, you'd have ans+=(n*s) for 34. Proceed similarly for each number in the input array.

    My submission: http://mirror.codeforces.com/contest/1195/submission/57225770

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

      What about d2. How to solve it.

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

        It's very similar. You just have to be careful about the weights in the 10's expansion that you assign to the longer number.

        For this, my approach was to maintain a frequency array having a[i] as the number of elements with length i.

        Now, for each number in your input array, traverse its 10's expansion. If you're at the ith digit then surely, all numbers with >=i digits will ensure that this ith digit will play out similarly as in D1. Only for numbers with <i digits, you'll have to figure out the 10's expansion weights.

        For ex., f(12,3456) = 341526 and f(3456,12) = 345162. Observe how for the lowermost 2 digits, this case was similar to the case for D1, ie. f(12,56) and f(56,12). You only have to be careful about the weights you assign to 3 and 4. You should be able to arrive at an equation for the weights in terms of the len(a[i]) and i. Think about it.

        My submission: http://mirror.codeforces.com/contest/1195/submission/57237562

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

Editorials?

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

can any one explain test cases in (problem D1) >> thanks ..

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

    3

    12 33 45

    you need to calculate element's sum of this

    f(12,12) f(12,33) f(12,45)

    f(33,12) f(33,33) f(33,45)

    f(45,12) f(45,33) f(45,45)

    calculated values of functions:

    1122 | 1323 | 1415
    1122 | 3333 | 3435
    4152 | 4353 | 4455
    

    you can present as

    1020+102 | 1020+303 | 1020 + 405
    3030+102 | 3030+303 | 3030 + 405
    4050+102 | 4050+303 | 4050 + 405
    

    you can see that sum of this equals to

    (1020*n + 102*n) + (3030*n + 303*n) + (4050*n + 405*n)

    where n=3

    or just:

    f(a1,a1)*n + f(a2,a2)*n + f(a3,a3)*n

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

What was the correct approach for A? Many people (including myself) got WA in test 13 :/

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

    Just store frequency of each type of drink and for any type of drink having frequency more than zero, say having frequency f, (f — f%2)/2, sets of that drink(decrease frequency by f — f%2), decrease the drink set count(originally ceil(n/2)) and after doing it for all present type of drinks, we have at max 1 drink of a particular type , so say K(not question's K) drinks are still required(Since all remaining drinks are having frequency 1) then choose to add minimum of (K, remaining sets) to the final answer, and finally that would be the answer I THINK!!!!

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

It's been almost 10hrs since the contest ended. Why isn't the editorial released yet ? Isn't it prepared beforehand ?

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

My submission for D1 gives a WA verdict for the test 5 1000000000 1000000000 1000000000 1000000000 1000000000. But the answer matches the expected output in my system. Any help would be appreciated. Link to my submission https://mirror.codeforces.com/contest/1195/submission/57257009

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

Where are the EDITORIALS?

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

can someone pls tell me where i went wrong. It is for question B,I used a function similar to binary search one and after 10 pretests I got wrong at 11th one. //

int ans(int l, int r) { if (r>=l)

{

int idx = l + (r — l) / 2; long long int o= idx*(idx+1)/2;

      if (o-(n-idx)==k)         return idx;
      else if (o-(n-idx)>k)     return ans(l,idx-1);
      else                      return ans(idx+1,r);

}

return -1;

} // the following test case gives me wrong answer. 999999994 108004280

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

How to solve E

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

    Consider the row and the column respectively. Let

    $$$r[i][j] = \min(h[i][j], h[i][j+1], \dots, h[i][j+b-1])$$$
    $$$c[i][j] = \min(r[i][j], r[i+1][j], \dots, r[i+a-1][j])$$$

    The answer is obvious.

    $$$\sum_{i=1}^{n-a+1}\sum_{j=1}^{m-b+1} c[i][j]$$$

    Now the problem is to find the minimum value of fixed-length subarrays in a sequence, and it can be solved in linear time with sliding window(or monotone queue)method.

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

Why is the meaning of question A so difficult? 0.0

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

Can anyone suggest a testcase to make this solution fail? https://mirror.codeforces.com/contest/1195/submission/57264099

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

    You can even take look at this one! I've checked your solution for all valid inputs such that $$$N \le 10^4$$$ and It was okay (I'm not sure that there exists any counterexample).

    This problem can be solved using the quadratic equation (submission).

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

    I don't think you will find one. The correct solution is:

    n + floor(3 -sqrt(9 + 8*(k+n))/2
    

    (actually for valid test cases the floor function doesn't change anything).

    This code does:

    n - floor((1 + sqrt(1+8*(k+n))/2) +1
    

    If we say x =8*(k+n) then the difference between these is:

    d(x) = floor((3 -sqrt(9+x))/2) + floor((1+sqrt(1+x))/2) -1
    = floor((1-sqrt(9+x))/2) + floor((1+sqrt(1+x))/2))
    

    For x>=0 we have 0 < sqrt(9+x) - sqrt(1+x) < 2 so d(x) is either 0 or 1.

    For valid testcases x is an even number such that 9+x is an perfect square.

    If 9+x is a perfect square and x > 0 then 1+x isn't, so d(x) will be 0.

    In other words, the code will get the correct answer for all valid testcases, even if it does it in a slightly strange way.

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

Hi,

these 2 people have exact same code for D2 all they did was just rename the variables and added spaces and random ass functions which have no job in the code. Is this allowed to do so? it can't be coincidence that their code is exact same except the variable names.

BTW they from same college too.

cuber_coder 57239152

RaunaqRoxx 57235255

Sad

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

    Cheating on codeforces is quite common. More shameful thing is that MikeMirzayanov doesn't take any serious action. I only remember one time when he responded. Otherwise he has nothing to do. But if you are red he might respond. Example when he even responded a blog asking for debugging help

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

      I guess we should not blame anyone for that, Codeforces contest frequency is so high, all the people who are providing these for free,work very hard .Not because of money,but because they love this work.if some people cheated it's shame on them.but I want to ask why are you wasting your time .I guess codeforces have plagiarism checker it might be slow.Think it as learning platform,its not some real exam.its the platform u make mistakes and learn. Time is valuable resource invest it in right direction, try to solve hard problems instead of looking into such matters, it's for your benefit.no offense.

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

Will the editorial be published for this round, vovuh?

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

The editorial will be within one-two hours. I almost done with it. Sorry for delay.

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

following is the solution for B in O(1) time complexity:-)

O(1) solution for B
expressions are :  1. (x*(x+1))/2 - y = k ( here x is the no of times she put candies)
                   2. x+y = n
                   3. let no of candies eaten  = req;
 solve 1 and 2 equations . we obtain a quadratic eqn in x , n  and k as given below -
 quadratic eqn : x^2 + 3*x -2*(n+k) = 0 
 solve this equation and take positive root .
 after finding the root(x) .. now we have to subtract this from n since we need
 how many she ate ..
 as we know  no of candies eaten(req) + no of candies put(x) = no of chances(n)
 thus req = n-x.
 this is the ans.
    for code click this link ->  https://mirror.codeforces.com/contest/1195/submission/57284355
»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve F

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

Can anyone help me indicate why this situation happens?

GNU C++11: https://mirror.codeforces.com/contest/1195/submission/57351255

MS C++ 2017: https://mirror.codeforces.com/contest/1195/submission/57351301

They are both my submissions (in practice) for problem E (https://mirror.codeforces.com/contest/1195/problem/E) in this contest.

They are exactly the same code yet submitted with different compilers, e.g., GNU C++11 and MS C++ 2017. However, the one submitted using GNU C++11 got wrong answer with the output 0 for the first system test while got accepted if submitted using MS C++ 2017.

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

What wrong with my submission on test case 5 D2 problem. Thanks in advance!

https://mirror.codeforces.com/contest/1195/submission/57376447

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

Hard div.2(A) problem ever:)

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

I know this is really late but test cases for F are weak; solutions which use doubles to store atan2(example: 58176014) pass system tests even though the following test case makes them output 3 instead of 5:

2
3
0 0
1000000000 999999999
0 1
3
0 0
999999999 999999998
0 1
1
1 2