ch_egor's blog

By ch_egor, 8 years ago, translation, In English

Hi everybody,

This Sunday there will be a 16th Moscow Team Olympiad, high school students competition based in Moscow that is an elimination contest for All-Russian Team Olympiad. This contest is prepared by Moscow Olympiad Scientific Committee that you may know by Moscow Open Olympiad, Moscow Olympiad for Young Students and Metropolises Olympiad (rounds 327, 342, 345, 376, 401, 433, 441, 466, 469, 507).

Round will be held at 10:05 UTC on Sunday and will last for 2 hours. Each division will have 6 problems.

Problems are prepared vintage_Vlad_Makeev, Glebodin, Andreikkaa, qoo2p5, mingaleg, Flyrise, cdkrot, achulkov2, grphil, Sehnsucht, Aphanasiy, Sender, DebNatkh, GreenGrape under my supervision with great help of GlebsHP, meshanya, Endagorion, Zlobober and Helen Andreeva.

Thanks to cdkrot for the round coordination and statement translation, and also thanks for MikeMirzayanov for systems codeforces and polygon, which was used to prepare problems of this olympiad.

Good luck everybody!

UPD1: The scoring distribution will be:

500 — 10001000 — 1500 — 2000 — 2500 for div. 1.

500 — 1000 — 1500 — 20002000 — 2500 for div. 2.

UPD2: Editorial

UPD3: Winners:

Div. 1:

  1. mnbvmar
  2. bmerry
  3. jcvb
  4. TLEwpdus
  5. WA_TLE

Div. 2:

  1. Ebola_Emperor
  2. Orange_User
  3. orbitingfIea
  4. little_waxberry
  5. fnch
  • Vote: I like it
  • +194
  • Vote: I do not like it

| Write comment?
»
8 years ago, hide # |
 
Vote: I like it -52 Vote: I do not like it

will it be rated for any division?

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

Unfortunately clashes with GP of Korea.

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

unfourtunately that's on my school time :(

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

A Russian Olympiad clashing with open cup, why am I not surprised?

»
8 years ago, hide # |
Rev. 2  
Vote: I like it +68 Vote: I do not like it

We're going to write it tomorrow official and my team is really scared of Mr.GreenGrape in problemsetters

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

Perfect time for Chinese users!

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

Perfect time for Korean users, as the contest is in 7PM, and they can't take today's GP!

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

GL&HF

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

hope not a mathforces

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

Really bad time for US users :(

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

Perfect time for Chinese users.Thank you Codeforces!

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

The site has slowed down significantly.

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

In Div 2 problem D, the time limit is very strict. Python solution not passing pretest 8 even after all possible optimisations.

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

Div2 D pretest 13?

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

Interactive Problem and Binary Search again.

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

What were the hacks on Labyrinth about?

  • »
    »
    8 years ago, hide # ^ |
    Rev. 10  
    Vote: I like it +25 Vote: I do not like it
    Input
    Output

    for those who used a single queue.

    UPD: It seems that not everyone used a single queue failed on this test.

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

CSAcademy saved me on E with the geometry tool.

»
8 years ago, hide # |
Rev. 3  
Vote: I like it +61 Vote: I do not like it

yeah i managed to hack the Grandmaster last minute!!!

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

After one hour of rocket science, I realised that answer for C is.

sort(s.begin(), s.end()); cout<<s;

»
8 years ago, hide # |
Rev. 2  
Vote: I like it +22 Vote: I do not like it

I bet there will be lots of FST (failed system test) on Div1.B/ Div2.D, since lots people are using queue instead of priortiy queue, which will results in TLE. Though, it is not easy to hack them :(

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

    Deque is enough, thought

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

      Wait. I don't understand. Wouldn't the same element be put into queue for more than one time? Just like SPFA? Does anyone want to explain that to me?

      • »
        »
        »
        »
        8 years ago, hide # ^ |
        Rev. 6  
        Vote: I like it 0 Vote: I do not like it

        Usual 0-1bfs — deque + array that indicates visited cells

        You won't visit cell with better cost than first visit.

        First time (using 0-1bfs) — cell will be visited with L left moves and R right moves, all other times it will be L+k and R+k where k>=0

        P.S. I hope it understandable enough

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

          So the cost will be different if you move vertically instead of horizontally, right? which means the cost in your queue can be not monotomous.

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

            No, it will always be monotonous.

            The idea, is to push a vertex at back of deque if the weight is 1, and at the front of deque if weight of edge is 0. Since, there can be atmost two levels of weight in queue, it will always be monotonous.

            My submission

            You can read about it here

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

              Oh! Use deque, then it is always monotonous! Such a neat application of deque! I got it. Thank you so much!

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

          I didn't think of why you use a deque instead of queue. Now I get it. Thank you!

»
8 years ago, hide # |
Rev. 2  
Vote: I like it -139 Vote: I do not like it

I am eblan.

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

whats the correct approach for div2 d?

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

I had RE 8 on D problem because of pragma

pragma

I think it can be a problem of new servers. MikeMirzayanov, can it be fixed?

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

how to solve F?

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

    Let dp(i) be the maximum length of a journey starting at position i.

    Then, dp(i) ≥ x iff there exists such j that i + x ≥ j, dp(j) ≥ x - 1 and s[j, j + x) matches either s[i, i + x) or s[i + 1, i + x + 1).

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

    You can get different and solutions with the following observation:

    There exists an optimal journey such that these conditions hold:

    1) The maximal length of a string in the journey is .

    2) The difference in lengths of two consecutive strings in the journey will always be 1.

    Mine didn't pass but maybe someone passed with such a solution.

  • »
    »
    8 years ago, hide # ^ |
    Rev. 3  
    Vote: I like it +34 Vote: I do not like it

    My solution is . Not sure if it will pass.

    I am going to assume the string to be reversed.This way the strings in a journey are going to be increasing in length.

    We can prove that there always exists an optimal answer when ti has length i. Now, let dpi be the largest possible length, such that the last string ends at position i. Note that if we can have a valid length l ending at i, we can also have a valid length l - 1, so it makes sense to define such a dp state.

    We can binary search on dpi. For a length l, the second last string is either same as si - l + 1... i - 1 or the same as si - l + 2...i. We find the rightmost such string which doesn't intersect the last string, and check if this string could be used according to the dp state.

    Finding the rightmost possible second last string can be done using persistent segment tree in . Basically, we have a range on the rank in suffix array the secondlast string can belong to, and a maxmium possible rightmost index for the secondlast string as the constraints.

»
8 years ago, hide # |
Rev. 2  
Vote: I like it -17 Vote: I do not like it

Time limit for Problem D is too strict :(

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

How to solve Div1 D?

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

My solution for Div2 D is failing on test 13. Could anybody help me where I am making a mistake? Thanks!!

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

    The time limit is too strict, possibly due to recursion and stack size.

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

    As far as I understand you did a dfs and checked the conditions and you dont visit the same place twice. However consider this

    .....

    .*.**

    .x.**

    x is where you are initially.

    lets say you can go left at most once and right at most twice.

    Then if you go left and go up twice and go right twice you will mark (0,2) as visited and when you come there again from (2,1) -> (2,2) -> (1,2) -> (0,2) you wont continue since it (0,2) is visited however you went right only once and if you continued you could go right.

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

What’s pretest 10 in div 2 E?

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

    Probably something like 1 black and 29 white.

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

    Yeah I was getting wrong answer on pretest 10

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

    n = 30, jury mostly assigns colors randomly.

    However there is a small twist: in all of jury tests (except for sample) if it is possible to assign a color, such that it makes impossible to separate points later jury will always do that :).

»
8 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Div 2 Problem C was tricky. I can't prove solution correctness. Can anyone give me a proof ?

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

gag forces?

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

With new Judging infrastructure, I hope System testing would be a bit faster.

So that i upsolve after that :)

»
8 years ago, hide # |
Rev. 2  
Vote: I like it +29 Vote: I do not like it

C and D combined made this the worst problemset in my opinion I've seen so far in codeforces.

C was binary search. Nothing else, just binary search, just hidden behind a silly problem statement about lines. There's lots of complaints about every interactive problem being binary search and then we get new problems like this :/

D was a math problem emphasizing exactly what I hate about most math problems. You just have to make a trivial observation (either n or the number of rounds is small), and then calculate stuff. Of course, the calculation isn't interesting either, It's just super annoying case handling.

The especially annoying thing about D was that the last person can take just one candy, even if they have a sweet tooth. That adds nothing to the creative part of solving the problem, and around doubles the amount of case handling. Why was that there?

In my recent memory I don't remember any problem worse than either of these, and now we got two of them on the same round :/

  • »
    »
    8 years ago, hide # ^ |
     
    Vote: I like it -10 Vote: I do not like it

    I 100% agree. Missed that sweet tooth — one candy case for 30 minutes during contest...

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

    Well, while I will agree that D had hard technichal part, I not very much agree with your complaints on C.

    You just needed to come up with cute binarysearch-like construction and the implementation is very short. If the problem was obvious to you -- just get AC in 5 mins and move on!

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

    For me div1C was not trivial, and had a lot of challenges, not just "implement binary search". I don't think the geometrical construction was obvious at all.

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

In problem D Div 2, why dfs not working ?? thanks

  • »
    »
    8 years ago, hide # ^ |
    Rev. 3  
    Vote: I like it +16 Vote: I do not like it

    (edited) dfs won't work, because you can end up in a square with "wastefully expended left/right moves". Meaning, you could end up in the same square later with fewer left/right moves. What do you do at this point? If you reprocess the square and start doing dfs again from it, you will TLE for sure. If you don't reprocess the square, you might get WA if later on you fail to reach some square because you had wastefully expended left/right moves earlier.

    edit 2: or maybe dfs will work if you can do dfs in such an order that you never wastefully expend left/right moves?

  • »
    »
    8 years ago, hide # ^ |
    Rev. 3  
    Vote: I like it +5 Vote: I do not like it

    Consider you started from vertex 'X' and at some point you are at vertex 'Y'

    DFS ensures that you visit every vertex only once so you won't come to vertex 'Y' again. But as the graph formed might be cyclic i.e. there can be multiple ways to reach a vertex 'Y' from 'X' and there can be a possibility that there is some shorter path to 'Y' that you'll miss.

    PS: Dijkstra :)

»
8 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

I got trolled by div2 C lol :/ Wrote 80 lines of buggy code...

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

    My solution in python:

    def ans():
        n = int(input())
        c = bin(n).count("1")
        ans = pow(2, c)
    
        print(ans)
    
    tc = int(input())
    for _ in range(tc):
        ans()
    
»
8 years ago, hide # |
 
Vote: I like it +47 Vote: I do not like it

Test 40 Div2D distroyed so many dreams :(

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

weak pretests in div2 D

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

The Div1 problem E about lasers is beautiful in my opinion, thanks to the authors!

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

I guess that my solution to F has complexity O(n2.5)... I implemented O(n1.5·log(n)), but it turned out to be slower and more memory-eating, so I resubmitted older brute force, which passed with max time lower than one second.

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

I GOT TLE IN TEST 10,IN DIV 2 C MY SOLUTION time complexity in o(nlogn) but still it got timed out. is it due to slow input output?

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

Can somebody please help me finding why my code for DIV2 D gives a run time error?? CODE

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

The difficulty curve was.. 98.9%, 75.2%, 73.7%, 5.9%, 2.1%, 0.4% (percentage of people who solved each problem)

Perhaps codeforces should consider including problems solved by between 6% and 73% of participants???

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

    Impossible

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

    It was a bit... unexpected to us.

    We held a presolving of the moscow team olympiad, from which the problems are. And most of the teams got accepted all problems except problem corresponding to Div1F.

    So I was even worrying whether our Div1D and Div1E are a bit too easy.

    • »
      »
      »
      8 years ago, hide # ^ |
      Rev. 2  
      Vote: I like it +3 Vote: I do not like it

      maybe the next time the presolvers group should contain not only red and orange coders, not only ROI prizers and ROI winners?

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

What's Test 27 in Div2 D?

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

Can someone explain why Div2 D Test 40 failed for me??

44306721

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

    Just go left, straight up and down, then go right. You can visit all the free cell. 0-1 bfs can solve this problem. Because moving up and down costs 0, you should push one colomn into the queue at the same time when visiting a new cell.

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

      but what is the issue with normal bfs even in normal bfs i am trying to find the node closest to a popped node so that the nearest nodes are reached first.

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

        Normal bfs just visits the nodes as quick as possible. This means it may go left and right for several times and reach the limits. But it is possible that existing a path which is longer than the first one but turn left or right less. In this situation, bfs will visit a node that already been visited, and won't push the new node into the queue, leaving some of the nodes not visited. My code

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

How to solve Div2 E??

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

    Use binary search! Put x somewhere to the middle (from 1 to 999999999) and fix it (x=3, for example) and try (3,0) (save the color). Next try (3,500000000). If these two point have the same color next point you should try is (3, 750000000) if colors are different next point should be (3, 250000000). Beware of edges cases: one with all points with the same color and when another one only one color is different 44313158 (very bad code, sorry)

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

Can someone look into my solution for DIV 2 D problem 44308344 and tell me where I am going wrong. Thanks :)

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

How would you guys come up with the solution for problem C, Div 2? And how would you test it to make sure that every time you sort the string’s characters you get maximum number of palindromes?

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

    Sixth sense!

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

    I manually checked it for random strings of length 10

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

    I was trying something on paper and I suddenly saw that for aaaaab the count is much higher than its other permutations, once I realised that I could prove it easily as :

    suppose you are counting palindromes with a as it ends, now if you insert anything in between two a's, that may decrease count by 1. Hence all occurences of a character must be together.

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

where is the editorial?

»
8 years ago, hide # |
Rev. 4  
Vote: I like it +5 Vote: I do not like it

DIV1 B:
Suppose, system tests are weak.
This solution based on simple BFS and single queue (not BFS-0-1) 44319324 passed all the tests.
UPD: tests are not weak, my solution differs from BFS in visiting vertexes twice and more times.

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

    I think this solution is right. It has right answer on my hack

  • »
    »
    8 years ago, hide # ^ |
    Rev. 2  
    Vote: I like it +21 Vote: I do not like it

    This is equivalent to SPFA (or Bellman-Ford with queue). It is a correct shortest path algorithm, and although its worst case complexity is O(VE), practically it's very fast for most graphs.

    SPFA can be hacked by specially constructed graphs, but I don't know whether such graph exists given the restrictions of this problem. Also, since SPFA is not popular outside China, non-Chinese problem setter usually don't make anti-SPFA tests.

    Disclaimer: My solution used the same algorithm.

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

      Thanks for the information, didn't know neither about SPFA neither about Bellman-Ford. There is a reason to read something.
      Finally, found the difference between my solution and simple BFS: in my case one vertex can be visited once again, if there is better path found.

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

      I've just known that some of the solutions implement BFS using deque instead of a queue, which allows them to keep the queue monotonous. Then the complexity is the same as a standard BFS — O(V + E), which is correct. However, I do think those solutions using queue is hackable, but there might not be anti-SPFA tests.

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

Div2 D Time depends a lot on Compiler, same solution in c passed and c# TLE

»
8 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

It's possible to pass Div2 D using shortest path if you use a faster heap in C++... http://mirror.codeforces.com/contest/1064/submission/44318340

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

How to solve Div2 F? Can this problem be solved with binary search?

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

Can anyone tell me why i am getting runtime error on pretest 8 44315444 Please help i am not getting the mistake

»
8 years ago, hide # |
Rev. 2  
Vote: I like it -6 Vote: I do not like it

Hey, ch_egor MikeMirzayanov cdkrot, my submission 44312315 gave TLE during contest, but identical submission 44320638 gives AC now. Can anything be done about it?

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

    Nothing can happen now. Same thing has happened with me twice, but they don't re-evaluate our code after the contest. See the codes 37815677, 37820871. They are identical but one gave TLE during system testing while the other one passed after the contest. I also posted about it in a comment, but no one even cared to reply. I also messaged Mike on CF, but he also just ignored the message. Here is the link for the discussion.

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

    Dude, your identical submission also nearly TLE'd. So the TLE during the contest seems reasonable. There is no reason to judge your solution again.

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

shorest solution I ever encountered:

input();print(''.join(sorted(input();input())))
»
8 years ago, hide # |
 
Vote: I like it -10 Vote: I do not like it

what is this c

ugh

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

Is it possible to get the complete input for test #10 in div2D? I'm really curious what I did wrong in #44322132 and can't get it...

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

BFS with one queue is fine for div2 D: 44322392

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

Thank you for pretests, GreenGrape

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

So much math.

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

Test 40 for Div2-D be like

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

How to solve Div 2 B i didn't able to find the approach

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

    Brute force solution for a from 0 to 20 and try to find a connection between a and the answer

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

      This is a good tip in general, it's way easier to prove if something in particular works (or doesn't) rather than finding the solution itself

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

    just observe that since

    If i'th bit of a is 1, then if i'th bit of x is 0 or 1, in both cases i'th bit of is 1, and we are safe.

    But if i'th bit of a is 0, then i'th bit of x must be 0, i'th bit of will be 2,i.e, greater than 0. which will make greater than a.

    hence the answer is

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

DIV1 B:

Suppose, system tests are weak.

Solutions: 44298986 44296043 Test:

3 3
1 1
1000000000 1000000000
.**
***
**.

Solutions have different answers: "1" and "2"("1" is correct answer).

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

In Div2 C,Can Anyone explain why the sorted String is the best answer.

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

Hello, could you throw a link to the analysis of this round

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

Nice Contest overall! Thanks Codeforces.

»
8 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

T̶h̶e̶r̶e̶'̶s̶ ̶p̶e̶o̶p̶l̶e̶ ̶a̶s̶k̶i̶n̶g̶ ̶f̶o̶r̶ ̶t̶h̶e̶ ̶e̶d̶i̶t̶o̶r̶i̶a̶l̶.̶ ̶T̶h̶i̶s̶ ̶i̶s̶ ̶t̶h̶e̶ ̶e̶d̶i̶t̶o̶r̶i̶a̶l̶.̶ ̶I̶ ̶g̶u̶e̶s̶s̶ ̶t̶h̶e̶ ̶a̶u̶t̶h̶o̶r̶ ̶f̶o̶r̶g̶o̶t̶ ̶t̶o̶ ̶l̶i̶n̶k̶ ̶i̶t̶ ̶h̶e̶r̶e̶?̶ ̶

̶h̶t̶t̶p̶s̶:̶/̶/̶c̶o̶d̶e̶f̶o̶r̶c̶e̶s̶.̶c̶o̶m̶/̶b̶l̶o̶g̶/̶e̶n̶t̶r̶y̶/̶6̶2̶4̶5̶5̶

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

I'm getting TLE when I'm not using if(visited[x][y]) continue; // for checking whether the node is visited before or not here is my code link https://ide.geeksforgeeks.org/bcROnzM4qJ

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

    It's possible for BFS (0-1 variant too) to have repeats of same element in (de)queue, so this is actually to be expected.

    For example, try drawing a "triangle" graph (three node cycle) to convince yourself. You will see that two of the nodes repeat.

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

Where are the winners?

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

can anyone help me with div2. D i tried floodfill but it got WA on test case 5

my approach now is to BFS but i get WA in test case 40 https://mirror.codeforces.com/contest/1064/submission/44454781

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

How to solve div 2 F? Will there be tutorial?