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

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

Hi everyone!

Baltic Olympiad in Informatics is being held in Bergen, Norway. Here is the official competition site.

I am wondering — will there be any online mirror? It would be great if there actually was one, it doesn't seem probable :/

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

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

Seems like you can register in https://boi17-open.kattis.com/ provided in the official website.

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

Can please someone share solutions?

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

How to solve A ???

:)

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

      How do you find cliques containing that node in O(2^k)?

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

        We know there must exists a node X with at most K neighbors. We'll find the one with minimum number of neighbors (so, at most K). Now, if we want a clique containing the node X, its members are limited to X and X's neighbors. Now, you can choose the subset of neighbors of X that are contained in the clique and check if they really form a clique. In my source, I've reindexed the nodes with numbers from 1 to K + 1 and remembered for each pair whether there is an edge or not. To do it, I just used a set, but it generally work with any hash (hence, K^2logM or K^2 time complexity for each iteration, but it's negligible compared to 2^K)

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

          Thanks a lot. Could you please briefly tell the solution to the second task?

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

            First, divide nodes of the original graph into N/K groups so that node number I belongs to the group I/N. Now we can define a single node X by its group number X/K and X mod K. As a preprocessing we store T[g][m1][m2][i] which denotes minimum distance from node which belongs to group g, is m1 modulo K to node in group g + 2^i, which is m2 modulo K. We can calculate this table by simple for loops. When we receive a query we can simply change nodes a,b to their groups g1, g2 and rests m1, m2, and then iterate through all bits of number g2 — g1 (jump pointers) in order to perform a simple "dp", we simply move number g1 to the right by powers of 2 contained by number g2-g1 and calculate our partial result (res[x] table which denotes distance from node a to current jump with modulo K equal to x) based on previous "jumps". After the iteration we print res[m2]. Time and memory complexity is something like N*K^2*logN.

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

      Correct me if I'm wrong, but I understood, that it's sufficient to apply such algorithm: 1) Select a vertex with min degree, remove it from the graph, reduce all its neighbours degree by 1 and put them in priority queue 2) Try all subsets of its neighbours to form maximal clique (as you've mentioned, the complexity of such process is 2^K, where K doesn't exceed 10? (or what?)(why does it always hold, as total neighbours count can be N-1?) And what's the overall complexity of yours solution? Is it N * 2^K?

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

        You understood it right.

        Total neighbor count can be N-1, but you selected a vertex with min degree, and there always exists some vertex with deg <= K (Because, by statements, such vertex always exists in any subgraph), So trying all subsets are sufficient.

        My complexity is N * 2^k * k^2

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

Will there be an online mirror for the second day?

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

No, really, will there be an online mirror for day 2? Cause' it's about to start.

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

Is there a solution easier (to write) than centroid decomposition with a segment tree for 6th problem?

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

Can please someone share solutions of second day?

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

    for B just observe that there are two types of possible boards:

    A[i, j] = ( - 1)xi + j for some

    A[i, j] = ( - 1)i + yj for some

    and each constraint gives us the values of xi, yj

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

      So answer is only 0, 1, 2? Or do I have to do some kind of DP?

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

        Let us look at the possible boards of the first type. There are two possibilities:

        • constraints are inconsistent for example one gives x1 = 1 and the other x1 = 0. in that case there are no solutions.

        • there are k different constaints. In that case there are 2n - k possibilities.

        Do the same for the second type. And be careful because there are two colorings (usual chessboard) which are of the both types.

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

    A: Solution sketch (I didn't implement the solution, though):

    1. Check if the relation of friendship is symmetric.
    2. Prove that there is solution in which each group is connected (if it's not, break each group into its connected components).
    3. Let cluster be a group whose size (call it p') not larger than p and having no more than q outgoing edges (let this number be q'). We allow clusters to be empty (it really changes nothing). For each vertex v, backtrack to find all connected clusters containing v. In each recursive step, take a vertex adjacent to our current group and decide (recursively) whether to take it to the set or say it's not going to be in the group. The first decision increases p', the second increases q'. Each recursive step increases p' + q', which in turn cannot exceed p + q. Total complexity of one backtrack is O(2p + q) (something like that). On each turn, we can check if our current set is a cluster (and, as we'll see later, we can actually terminate the backtracking when we find any such cluster). As we run it for each vertex, total running time is O(n2p + q). And probably much faster.
    4. If there's no cluster containing some vertex, the answer is NO.
    5. In the opposite case, for each vertex pick any cluster containing it. It gives us n clusters covering all the vertices. Now for each pair of selected clusters A, B we're going to transform them (to A', B') so that and . We can prove that at least one of , is a cluster (some easy inequalities on the number of the outgoing edges). If the first one is a cluster, transform (A, B) into . The second case is symmetric.
    6. After running the reduction on pairs of clusters above, we're left with a set of clusters (some of them might be empty) which are pairwise disjoint and cover all the vertices. This completes the construction. The complexity of this phase is O(pn2).
»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +40 Проголосовать: не нравится

I'm sorry to revive the topic. Although the contest is over, but does someone know whether it will be possible to submit solutions for Day 1 contest? Because it appears, that only submitting problems for Day 2 is available at the moment, or am I missing something?

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

Is there any way to submit solutions now? The Kattis contest is dead.

UPD: Apparently not...