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

Автор cyand1317, история, 8 лет назад, По-английски

Selamat petang!

The curtain has fallen on Codeforces Round 487 (Div. 2). Have you enjoyed the problems themselves? Or the stories? Or both? Neither?

I hadn't ever intended to create a hard contest, believe me... (╥﹏╥) The author will try to find ways to estimate the difficulty better in the future. Also, stronger pretests, notes taken.

Anyways, hope you've all enjoyed the challenges you've faced, and gained something from this round. Congratulations to those who performed well, and commiserations to those waiting for their next chance to shine (^_−)−☆

Below are the tutorials of all problems. Feel free to point out mistakes (if any) or share your ideas in the comments! I might be overcomplicating or confusing something > <

Tutorial is loading...
Short Ruby solution
Tutorial is loading...
Noam's C++ solution
Python solution for the original problem as well as for the last challenge
C++ seemingly-brute-force solution
Tutorial is loading...
Model solution
Tutorial is loading...
Model solution
Tutorial is loading...
Model solution

See you next time! I hope I'll be welcomed. Cheers!

Разбор задач Codeforces Round 487 (Div. 2)
  • Проголосовать: нравится
  • +144
  • Проголосовать: не нравится

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

Editorial is cool like announcement!

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +51 Проголосовать: не нравится
A bit simpler C solution picture
»
8 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

Super fast editorial !

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

Can anyone please explain the solution for C in English?

Edit: I believe I understand now. Thanks!

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

woah, rating change of 195 in just 30 hours for me.boss feeling

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

Really enjoyed today's contest, thank you cyand1317

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

Found a smaller solution for A, simply changed product to XOR in your Ruby solution ^.^

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

I know that in problem C, number of components cannot exceed 100. But will your solution work for inputs like "1225 1225 1 1" if we remove that constraint?

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

My solution to C:

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

for p==n in Problem B there was no way to conclude answer is No as only about positive p the condition was mentioned. This cost me whole problem. sad wordings :(

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

Please explain C, can't really seem to get the editorialist's code also to mention the picture too!! :P

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

Ques C was Interesting.Good Contest this. cyand1317.

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

It is easier to solve D (in linear time for sorted input) if u divide points on basis of sign of x and v and u won't have to worry about fractions. http://mirror.codeforces.com/contest/989/submission/39163175

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится
my solution for C
»
8 лет назад, скрыть # |
Rev. 5  
Проголосовать: нравится +30 Проголосовать: не нравится

My solution on C with input

100 100 100 100

not fine,but can accepted! :)

pic
»
8 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится
My C solution's picture

Thanks for your efforts :)

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

My picture for C (test 100 100 100 100):

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

Thanks for this super-ultra-hyper-mega-meta-great-delicious-wonderful contest cyand1317 !

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

hope every time editorial is this quick

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

IN EDITORIAL OF E -> can you please explain this line "For each l, we should calculate the average of f(m−1)u such that the u-th point lies on l"

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

My code runs perfectly okay on test 18 of B but it is giving an WA on test case 18. I am using g++ compiler on my pc. Can't understand why, since the output it produces in the test case should not be produced by program logic.

Submission link : My Submission

Any insight would be helpful.

Thanks!!!

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

Here's my C for input 100 60 13 1

Very fun question, good job cyand1317 :)

(My solution handles 1 ≤ a, b, c, d ≤ 145.)

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

With a pattern like this you can handle cases with a,b,c,d <= 385.

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

(2018-06-12_050251.jpg)

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

problem D 2 10 100 2 1 1 -1 answer should be 1 but the standard puts 0 it shouldn't be xu<xv but xu<xv+l(?)

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

Mine is a little bit too complicated.

A = 100, B = 90, C = 70, D = 50

cries

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

my solution

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

For those looking for an idea to solve problem C, this is a really simple solution. Feel free to check my submission if you want. The code works fine even for a,b,c,d <= 300. This is the case where A = B = C = D = 100 :)

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

My solution to E is actually in O(n4 + 30n3 + qn3)-time, where 30 is the laziness cutoff mentioned in the editorial. It passed the system test just because I was lucky :) http://mirror.codeforces.com/contest/989/submission/39167167

I enjoyed this contest very much. Thanks!

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

http://mirror.codeforces.com/contest/989/submission/39180094 This is my solution for Div 2-B , I think it will also work for bonus-3(n<=10^5), but I am not sure,please correct me if i am wrong .

Thanks in advance :)

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

Problem E turns out to be an exact Markov chain problem xD

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

    plz explain the problem

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

      let

      each entry represent the probability (ex : 1 → 2 is the probability of going from 1 to 2)

      Then, A2 =

      (this one is bit hard to recognize, by the way.)

      By generalization,

      where ... can be any sequence of n - 1 vertices

      The answer is MAXline(sum - of - the - (row, column)[Mline * Am - 1]) where Mline is initial state of for each line and (row=index of vertices belongs to initial line), (column=vertex index of destination) (i'm sorry this must be hard to understand, but this is my best explanation) (and with some optimizations originally written in editorial)

      You can google 'markov chain' for much more elegant explains.

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

Can someone please explain the solution (visualization) of problem D.

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

The idea is simple:

Implementation is here: http://mirror.codeforces.com/contest/989/submission/39190964

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

http://mirror.codeforces.com/contest/989/submission/39194022

With a slight change, up to 183 zones of each color will work, giving out a table of 50 * 48

My solution for "100 100 100 100":

Output

My solution for "50 30 25 10":

Output

Maybe in future I make it in images, but now it only text(

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

In problem D editorial: "For a pair of rightwards-moving cloud u and leftwards-moving cloud v, their intersection in the diagram has a top corner of ... ", is y coordinate correct? I think it should be (x_v + l — x_u) / 2 instead of (x_u — x_v + l) / 2 (x_u < x_v, right?)

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

My sol for C 100 100 100 100

Spoiler

sol for 1 1 1 1

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

cyand1317 Sir, I know basic programming like i am able to solve Div2 A,B, C(sometimes)...... Can you tell me what all topics(and from where) i should do to improve so that i will be able to solve div2 C and Div2 D much easily....... Thankyou...

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

I love your D, such a cuuuuuuute and beeeeeeeeeautiful idea!

Rua~ cyand1317

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

My simple solution! INPUT: 77 33 22 144

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

no time to read the story...

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

Bonus. D Solve for intervals of various lengths, with possible intersection at the beginning.

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

I get wrong answer in Pro E for Error of accuracy, and my 1.5 hours run out. Maybe we should pay more attention to the calculation of plane geometry...

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

For problem E instead of taking average I did

cases:

1) M turns starting from point in S 2) First turn from point not in S + M-1 turns starting from point in S

and I took max of resulting vector

It seems precision is worse, and it failed seventh test case by 7*10^-6 (error margin is 10^-6). Now is it just precision problem or is there some logical error. And how to improve the accuracy?

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

 So cool!! I love this author!