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

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

Hello everyone!

The problem set of the 2018 ACM Syrian Collegiate Programming Contest will be available in Codeforces Gym on Nov/23/2018 17:00 (Moscow time).

You will have 12 problems and 5 hours to solve them.

The contest was intended for teams, but I believe it is more interesting for yellow and red coders if they participate individually as they will get to try all the problems.

Your solution should read the input from file, and output to the standard output (stdout).

Problem setters are Motarack, Vendetta., Reem, Dark, and Hasan0540.

Thanks to Jester, Hiasat, Noureldin, Badry, sqr_hussain, Mohammad Asaad, and Majd Akleh for the help in preparing and testing the problems.

I hope that you will find some interesting problems for you. Any feedback is appreciated!

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

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

Contest was moved to 23.11.2018 17:00 (Московское время) as there's another gym contest on Saturday.

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

The contest starts in 25 minutes. The first test case is the same as the sample test case. Don't forget to read the input from the required file.

Good luck!

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

how to solve F no. problem of this contest?

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

How to solve J?

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

    Greedy algorithm: KAN chooses the first to unlock the groups by priority of earliest second time first. This works because it unlocks something for the other to do while he unlocks other groups (if it doesn't, any other choice also doesn't).

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

I was a contestant in the onsite competition, I have to say this problemset was really nice and interesting problemset.

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

How to solve H?

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

How to solve C without cheating with Dinic?

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

How to solve D?

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

How to solve K?

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

    Start from highest value to smallest. Assign color = mex of neighbours.

    dont know proof :P

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

      Nice Solution.

      I think you can prove it easily. Each has atmost 2 edges with heights greater than it.So mex can be atmost 2. And now for bipartite graph we get always two colors since we always explore the graph in a connected fashion rather than random vertices.

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

    Another solution that is probably less interesting but it's good to know these facts about the constructed graph:

    The graph is planar, triangulated, and all vertices are boundary vertices. Check the following image:

    Picking an edge and coloring its ends will split the uncolored vertices into some components, each component will have one vertex with one option, coloring that vertex will leave another vertex with one option... So after picking an edge everything will be uniquely determined unless there's a bridge, in that case you will have more than one option.

    Implementation: always pick the vertex with the minimum number of remaining options and color it with the minimum available color index (just to make it work on bipartite graphs too). This solution works in O(n) since each vertex will have at most 3 options (no need for a heap or sorting).

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

Solutions for E,L ?

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

    E:

    Find three nearest vertices which can propagate to each vertex(based on distance and index as mentioned in question) and then we count all those which has a red as nearest. Similarly we count number of vertices for each blue such that if we remove it will become red also for all pairs of blue similarly. Now we iterate over all pairs of blues and find the most optimal to remove by adding first counts of each blue and pair count. We need to notice that only n pairs of blue are good. rest always contribute zero to second count. So this can be done in O(n) .

    I think first part of finding three vertices can be done with priority queue similar to dijkstra,

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

How to solve problem I using normal geometry? I iterated through all points of generated polygon iteratively some 1e5 times and pushed the starting point [alpha=0.5] times the extra length inside the circle if any of the points is outside the circle of radius R. Here's the code

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

    It can be solved by finding the Smallest Enclosing Circle of all visited points starting from (0, 0).

    You will get a center point C and all you need now is to move the starting point so C becomes (0, 0), thus the new starting point is -C.

    The algorithm is pretty much similar to your solution. I can't open it, btw :1.