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

Автор chokudai, история, 4 года назад, По-английски

We will hold AtCoder Beginner Contest 237.

We are looking forward to your participation!

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

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

for D I created binary tree and did inorder traversal on it. I'm sure there's better approach for it.

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

I don't know if it's a bug in atcoder or the problem was updated, but I got the statement for problem D as problem B at first before I reloaded: https://imgur.com/a/FFEzsaY

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

Can somebody explain why a super simple bfs in E does not TLE?

Edit: In example this submission

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

    Simple BFS worked for E ? :( I had to do Bellman Ford to solve it My Code with Bellman Ford

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

      I used max Dijkstra

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

        I thought of using it then remembered it does not handle negative edges so Thought of using this

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

          negative edges are ok, but not negative cycles. And there are no negative cycles as this would be physically impossible

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

            Why are negative edges ok but not negative cycles? Doesn't dijkstra work because before processing vertex v, we have already processed all vertices with distance smaller that distance to v, and negative edges would break this

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

              Depends on your implementation, if you allow to visit a node more than once you will be fine. The runtime analysis is then a bit more complicated, but I believe it should better than Bellman Ford, as latter will do the maximum amount of iterations possible, while Dijkstra might stop earlier..

              Implementation using a set, to update keys inside the priority queue (from CP4)
    • »
      »
      »
      4 года назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится +12 Проголосовать: не нравится

      How did you do bellman Ford? It's n^2 right. And how are dijkstra solution passing for E. :(. There are negative edge weights. It should fail!!

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

    The while() cycle does what a normal while() in bfs does — goes over all nodes, so O(n) from here. For every node, we traverse all its edges and since every edge has two endpoints, this means we get O(2M) iterations from here. So all in all we get a complexity of O(n + 2m). Hope that helped!

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

    I think it's SPFA, Shortest Path Fast Algorithm. It will run in approximately O(N + M). It doesn't get TL because it's hard to construct a good graph.

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

      Thanks for pointing that out. Actually, that is what I referred to as "super simple bfs". It looks like dijkstra but with a simple queue instead of a priority queue.

      And also the problem with this is described in the article, its worst case complexity is like Bellman-Ford, so would TLE.

      On the other hand, the way the tree is constructed makes to edge weights not arbitrary, they obviously determine each other. It seems that this makes the simple algorythm work.

      Which, frankly said, makes the problem a bad one. Given the fact that this is a beginner contest, we can assume that a lot, maybe the most partitipants who solved it did not because beeing smart enough to see that.

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

Me after solving A,B,C,D,E

Spoiler

Can anyone explain their approach for F as editorial is not published for now.

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

Ex and div1f of last round are exactly the same problem.(After building the graph)

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

problem G

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

Anyone with Top Down approach for F ? It will be great if you can share your code

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

I solved Ex using a greedy maximal clique solution.

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

why don't atcoder amalgamate test cases like cf and cc it will be easier to copy and check on local compilers

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

The editorial is available in Japanese but not in English. Maybe there is just a script to run to make it available ?

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

can someone explain problem e solution plz

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

When will be the editorials posted? It has not been posted yet.

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

Since official English editorials never arrived, I translated all Japanese editorials myself. They are brief and not word-to-word precise, more like my own restatement of the official solution. Hope it helps.

https://atcoder.jp/contests/abc237/editorial/3347

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

can someone tell why max Dijkstra on problem E getting TLE?

My submission