gridnevvvit's blog

By gridnevvvit, 11 years ago, translation, In English

Hello!

Soon (on October 1 at 19:30 MSK) you are lucky to participate in Codeforces Round #203 for Div. 2 participants. Traditionally, Div. 1 participants can take part out of the competition.

Problems have been prepared by me. I want to thank Gerald Agapov (Gerald) for help in preparation of this round, Ilya Los (IlyaLos) for testing of problems, Alexander Ignatyev (aiMR) for testing of problems and for idea of one of the problems, Michael Mirzayanov (MikeMirzayanov) for marvelous Codeforces and Polygon systems, Mary Belova (Delinur) for translation of statements.

Good luck!

UPD:Scoring will be dynamic. Problems are sorted by increasing order of difficulty.

UPD: Congratulations to winners:

  1. fanhqme
  2. FAU.COACH
  3. Witalia
  4. sokian

UPD: Editorial

  • Vote: I like it
  • +144
  • Vote: I do not like it

| Write comment?
»
11 years ago, # |
Rev. 2   Vote: I like it +44 Vote: I do not like it

Happy National Day for all Chinese participants!

Wish everyone a high score!

PS: It would be better for us Chinese participants if only start time of each round could be made a little bit earlier...

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    can't agree more. contests on codeforces always start at Beijing time 23:30 toooooo late...

»
11 years ago, # |
  Vote: I like it -31 Vote: I do not like it

GL&HF!

»
11 years ago, # |
  Vote: I like it -25 Vote: I do not like it

I hope this contest don't like last.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    whats wrong with the last one? (:

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it -24 Vote: I do not like it

      You can surely see my username written in green colour ,can't you !! This is what happened in the last contest :(

      So, fingers crossed this time :) (y)

»
11 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Why is it that registration closes before contest ?? and we can't enter after the contest hast started?

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Valid point. But I assume one reason may be challenge phase. If there is no registration there might not be fair and optimal way of room assignment as every body will simply log on at the time of the competition.

»
11 years ago, # |
  Vote: I like it +8 Vote: I do not like it

R.I.P clarity..

»
11 years ago, # |
  Vote: I like it -8 Vote: I do not like it

I submitted problem C in Java to get TLE on test case 5. Rewrote the same algorithm in C# and it passed test case 5. That's really not fair. >.<

»
11 years ago, # |
  Vote: I like it +29 Vote: I do not like it

The problems translations to English needed more work. Also problems A, B & C didn't have any explanation for their sample tests.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Couldn't agree more. I took much time reading description of Problem B and hardly got how sample tests works because of no explanation, but easily understand Problem C by a quick glance.

    I think Problem C should be set before Problem B.

»
11 years ago, # |
  Vote: I like it +21 Vote: I do not like it

i can't understand problem B :(

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    i have same problem. but i sent a clarify question and understood it. when you cant understand a problem you should send a clarify question. they often send you a compelete answer! sorry for my poor english.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Same here. It was very difficult understanding the problem B. But looking into the submissions in the room, I was skeptical of making my comment. I think we as a community will benefit if the problems are better written.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    The same to you!!!

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    it's the only problems that I solved :lol:

»
11 years ago, # |
  Vote: I like it +9 Vote: I do not like it

The title of the competition is too difficult to read!!!

»
11 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Could not submit E on last minute as server was down :-( 5 additional minutes should be granted IMHO

»
11 years ago, # |
  Vote: I like it +6 Vote: I do not like it

I think some phrase and grammer is difficult to realize for people have poor english like me.

»
11 years ago, # |
  Vote: I like it +3 Vote: I do not like it

8 successful hacks for problem A with this test case 2 1 3 5 10

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

From where I can get the tutorials for the contest?

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    editorials will be published after some time...

»
11 years ago, # |
  Vote: I like it +2 Vote: I do not like it

I failed to submit my solution for problem C the last second before the end because I can't enter the site.what a pity!

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    I was in exactly same situation...

    15 sec remaining, I submitted problem D but.. the submission was denied..and the contest ends.. :(

»
11 years ago, # |
  Vote: I like it +11 Vote: I do not like it

problems did not interesting,did not short,did not have sample test explanation,statement was not perfect.

I don't like this contest :) may be becose I wrote badly ;)

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    E is interesting indeed.

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I have no time to read problem E :( i was tryng to translate problem B with my fully english,and to solve problem D becose was thinking that problem D would be easy than problem E as usual time :)

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      statement says : "a graph without any loops and multiple edges" , what's meaning of loop ??

      • »
        »
        »
        »
        11 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        An edge from one node to itself

      • »
        »
        »
        »
        11 years ago, # ^ |
          Vote: I like it +5 Vote: I do not like it

        A loop is an edge whose both ends are connected to the same vertex.

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

duh! And C went to 1000..

Scoring should be gradual not sudden like 500-1000-1500 ...

»
11 years ago, # |
  Vote: I like it -7 Vote: I do not like it

When will ratings be updated???

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For Problem C :

My java code gets TLE at test 5 .

This is the Code : http://codeforces.net/contest/350/submission/4630115

After The contest I changed it to C++ And the same code passes :

This is my C++ code : http://codeforces.net/contest/350/submission/4632017

Kinda disappointing :/

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I think it's because of big amount of System.out.println()

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Maybe I shall use String Builder and append stuff together , but I couldn't get that this is the reason of my TLE. :/

      • »
        »
        »
        »
        11 years ago, # ^ |
          Vote: I like it +5 Vote: I do not like it

        You could try using PrintWriter

        PrintWriter out = new PrintWriter( System.out ); // all your prints out.flush() // send your prints to the output

        It is faster.

  • »
    »
    11 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Sorry, there is.

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How do you solve it without sorting?

      • »
        »
        »
        »
        11 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I'm getting the closest points to my starting point to avoid facing a bomb in my way to a far bomb and it goes like that till the end so the condition is satisfied.

        • »
          »
          »
          »
          »
          11 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Ok, and how do you take the closest point to the origin?

          • »
            »
            »
            »
            »
            »
            11 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            By getting the minimum sum of (x + y) for the bombs points

            • »
              »
              »
              »
              »
              »
              »
              11 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              And isn't it faster to sort the bombs by x+y and then iterate through them? Since it is still not enough to get AC using Java, I don't think that choosing the min(x+y) with O(n) for every bomb works in 2 sec in any language.

              • »
                »
                »
                »
                »
                »
                »
                »
                11 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Sry I misunderstood you , I was explaining how im sorting them but without sorting Idk how to do it

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

From problem E:"non-directed connected graph from n vertexes and m edges, containing no loops and multiple edges"

Doesn't this mean that the graph is a tree?

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    No, loops != circles. No loops simply means that there is no edge from one node to itself.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    loop != cycle. loop is an edge from a node to itself

»
11 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

In problem C, can anybody explain to me why this get AC,

// std::sort(..., ..., cmp) ;
bool cmp(dot d1, dot d2){
	return abs(d1.x)+abs(d1.y) < abs(d2.x)+abs(d2.y) ;
}

while this was not?

bool cmp(dot d1, dot d2){
	if(d1.x == d2.x)	return abs(d1.y) < abs(d2.y) ;
	return abs(d1.x) < abs(d2.x) ; // move x first, y second.
}

Thank you for your reading.

edit: Thanks for reply. I found a test case that make sort() result not correct.

a = (1, 3), b = (-1. -2), c = (1, 2) in my code (1, 3)==(-1,-2), (1, 3) > (1, 2), (-1, -2)==(1, 2) b = a, a > c, b = c → b=a>c=b, so a&c may not sort correctly.

  • »
    »
    11 years ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    Two dots: (2;10000) and (5;6). First one is definitely more distant than the second.

  • »
    »
    11 years ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    i got AC with first line of cmp being if(abs(d1.x) == abs(d2.x)) and second line same as yours above.

    the Manhattan distance cmp function would also give you AC.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Little tangent, but second cmp ( sort comparison function) is not right.

    For both calls, cmp( (5,100), (-5,100)), cmp( (-5,100), (5,100)) it returns true. It breaks transitivity. http://en.wikipedia.org/wiki/Comparison_sort

  • »
    »
    11 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    But I got AC using both sort method above. Why?

    Correspondingly,

    1. 4639463

    2. 4639478

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Your compare

      return (abs(a.x)==abs(b.x))?(abs(a.y)<abs(b.y)):(abs(a.x)<abs(b.x));

      is different to the op. You are checking equality for the abs while op is not.

»
11 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

topped my room for the first time and advanced to Div-1 even though i failed A! :)

P.S. very weak pretests for A!!

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why does my code for Problem B give MLE? I have no idea.

    http://codeforces.net/contest/350/submission/4633434

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Looks like recursion depth. May be could not allocate enough stack.

      • »
        »
        »
        »
        11 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        I don't think that is the reason because I do not see any unnecessary recursive calls. It's similar to how others have done it.

        Edit : On taking a closer look, I realized that my code is not using a vis[] array hence, there is a possibility of it getting trapped in a cycle which causes stack overflow. You are right. Thanks :)

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Failed to get Problem C because I used formula to find gradient instead of the distance formula. All this because I had little time left and rushed everything. Just saw that and corrected the formula to get AC. Absolutely deflated :(

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks to the problem setter and testers!!

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi, I tried debugging my codes but could not find anything wrong. Please help me to find what is wrong with my solutions.

350C - Bombs — solution id 4631490
350B - Resort — solution id 4628087

The test cases are only partially shown so they were of little use.

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think the second test case for problem B is wrong as i got 1-2-4-5 and k=4; while the testcase says 4-5 k=2.Please can someone clarify please.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Got it condition 2 of problem each object must have at most one connection to another object. I'm thinking in line of LIS is my intuition correct?

    • »
      »
      »
      11 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      notice that path 2-4 is invalid as 2-3 also exists. a path is valid if the starting vertex leads to one other vertex only.

»
11 years ago, # |
  Vote: I like it +2 Vote: I do not like it

thx this contest..I get 246 points.

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem A, my program got WA on test #24 (expected 4, but got -1). I ran my code on my machine, however, the output was actually 4. I don't know why it got -1 on codeforces (even after I resubmit the code, it was still WA). Here is my contset submission 4621813

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Enjoyed the contest very much.Hacked 8 solutions successfully with the test case 3 1 3 4 5 8

»
11 years ago, # |
  Vote: I like it +1 Vote: I do not like it

In my opinion, I prefer concice problem description, long description always take nonnative more time to understand, I think the algorithm matches should reduce the differences between native & nonnative.

»
10 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Problem C's TL should be increased. this tight TL is not fair

Here is my code which at first stocked at test 5 after adding "ios::sync_with_stdio(false)" it passed and again stocked at test 6

here is my submission http://codeforces.net/contest/350/submission/7048251

just look at the times in AC codes here : http://codeforces.net/contest/350/status/C