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

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

Update 2019/06/12: Me and MikeMirzayanov managed to upload the Div.2 contest into Gym. Huge thanks him for the great system, and also a kind help!

However, I decided not to just open it, but to give a training contest. The contest is scheduled in June 14 Friday, 09:00 UTC. Even considering some obvious bias from the setter, I'm personally very proud of the Div.2 contest :D I hope you participate and share the same joy with us! (and of course, please don't cheat!)

.

.

.

.

.

.

.

.

Update 2019/06/05: I managed to upload the Div.1 contest into Gym. Have fun! https://mirror.codeforces.com/gym/102201

Open Cup GP of Daejeon is scheduled at 2019/05/05 Sunday, 11:00 MSK. Daejeon is a city where KAIST is.

Division 1 problem set is identical with MIPT PreFinals Camp 2019 Day 6. It was held on March 15.

Division 2 problem set is identical with KAIST RUN Spring Contest 2019. It was held on May 1 locally. Like last year, it was an IOI-style contest, but as we are doing in OpenCup, subtask will be disabled. Some problems between Div1 and Div2 are shared.

Problems were created by ainta, Konijntje, ko_osaga, kriii, kdh9949. Some problems in Div1 were borrowed by Diuven, imeimi.

Problems were tested by arknave, dotorya, Namnamseo, tzuyu_chou, .o..

List of relevant previous contests:

Enjoy!

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

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

Who all can participate? How can i request for Login authorization?

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

I got TLE in J using bipartite matching (O(√N*M)). Is there any faster solution or was my implementation too slow?

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

    My Kuhn works in 444ms, lol.

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

      Thank you. I copied your implementation of bipartite matching and got OK...

      I tried also this but it was too slow too. I'm interested in library codes of people who got AC in J in the contest.

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

    The intended solution also uses $$$O(E\sqrt V)$$$ bipartite matching. My solution runs in 420ms out of 3s.

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

    Did you solve whole problem with flow or search for matching of size n-1, and than full solution without flow? Solving second part with flow too shouldn't work.

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

    https://mirror.codeforces.com/blog/entry/17023

    The article is in Russian, but you can try Google Translate and also it contains the key part of the source code.

    I googled it using the words "codeforces, burunduk, Kuhn" because I remembered that a fast implementation by Burunduk1 exists that everybody use when I struggle with Dinic.

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

      Thank you. I didn't know that article. It was easy to understand for also non-Russian speaker :)

      I tried to use BFS instead of DFS in Kuhn and it became faster.
      Then I changed it to multi-source BFS, it became faster more.

      code

      It looks close to dinic so I'm not sure but I think It could be $$$O(\sqrt{V} E)$$$.

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

Thanks for the participation!

Problemsetter:

Solution for Div1

Solution for Div2

We also know that solutions are poorly written, sorry :( Thanks to xuanquang1999 for pointing out critical typos in Div2B solution.

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

Would the problem set be available in Codeforces gym later?

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

Where do these contests take place?

Is there an email address that I can contact for creating a sector?

I tried messaging snarknews but his last visit was 2 weeks ago.

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

How to solve C and I?

I assumed C is some dp over components of two-connectivity and parity of cycles, but did not come to the final solution.

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

    C: The solution in pdf is written by Endagorion, so it might differ with my intended solution.

    For a permutation $$$p$$$ to contribute to the determinant, $$$(i, p_i) \in E(G)$$$ for all $$$i$$$. This means $$$p$$$ should cover all vertices with the collection of edges and cycles. If it's a cycle, it should correspond to some biconnected component in cactus. So you can run DP on each BCC, where you can decide whether you cover a cycle, or not.

    There is a catch, because every permutation actually contributes to the answer by $$$inv(p)$$$ mod 2. However, it is equal to the number of even cycle in the permutation $$$p$$$ mod 2. So if you add matchings or even cycles, negate it.

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

We solved E (7 minutes after the end) using a bit different (maybe equivalent?) approach rather than the mentioned one in the editorial.

First, find the partition for N lunches and N dinners (sort by lunch-dinner difference). Second, solve problems in decreasing order of sizes (from N-1 to 1) using the solution for the previous one.

At each step there are three possibilities:

  1. Remove two heaviest dinners and move the lunch with smallest difference to dinners

  2. Remove two heaviest lunches and move the dinner with smallest difference to lunches

  3. Remove the heaviest lunch and the heaviest dinner

We used the same 4 mentioned sets from the editorial to do it in $$$O(N \log N)$$$.

P.S. it looks that the solutions are dual, but I can't prove it :)

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

Auto comment: topic has been updated by ko_osaga (previous revision, new revision, compare).

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

Auto comment: topic has been updated by ko_osaga (previous revision, new revision, compare).

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

"Some problems between Div1 and Div2 are shared."

So who have seen the Div1 problemset should not participate in the Div2 contest?

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

30 minutes left~

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

For B, I think the answer is always $$$1$$$ or $$$2$$$. The former case is trivial to detect. For the later case, I thought about choosing random $$$100$$$ vertices and then check each of them in $$$O(n^2 / 64)$$$ using bitset. But seeing how many submission get TLE, I don't think this solution is correct.

UPD: I have just read the solution for B, but I think there are some typo in the proof.

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

From Problem A editorial:

Observe that, A+=A is equivalent to B/= 2, and vice versa...

Why is this true?