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

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

Hi,

We would like to invite you to participate in the live (with 30-minute delay) online mirror contest of The 2019 ICPC Asia Jakarta Regional Contest (our regional website, our regional in ICPC website, official contest portal) this weekend. The online mirror contest will start on Oct/27/2019 06:30 (Moscow time).

The contest consists of several problems and you can solve them in 5 hours.

See you on top of the leaderboard.

UPD1: Thanks for participating. The problems should be available for upsolving. The soft-copy of the problem analysis (the same as the one distributed to all contestants during the awarding ceremony) is available here.

UPD2: The full problem repository is available here. The full problem repository for Indonesia National Contest (INC) 2019, which is the national programming contest that serves as the online preliminary round for Indonesian teams to advance to The 2019 ICPC Asia Jakarta Regional Contest, is also available here. The problems are also available for upsolving in TLX (INC and ICPC)

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

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

Too bad that it clashes with my FHC schedule. Anyway, I think Jakarta had the finest problems in East Asia ICPC last year. It would be a good practice opportunity.

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

The link to timeanddate.com redirects to 27th October of 2018. I guess someone is still living in 2018.

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

    Sometimes I am wondering why I can be a red coder when I still make this kind of careless mistakes. This is why we shouldn't copy-paste things (I copy-pasted the timeanddate URL from last year).

    Anyway, thanks for pointing it out. It is fixed now. Take my upvote!

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

Please change the link to https://codeforces.com/contests/1252 instead of https://codeforces.com/contest/1252 . Right now it shows "contest has not started".
People can directly register by visiting the first link.

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

Maybe I'm a new of Codeforces ... Could you tell me if I participate as a team member , will my personal rating change after the contest ... ?

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

Just curious if it is rated? if rated how would the rating mechanism work for a team against individual?

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

    I was just considering this question and wanted to know how rating will be calculated. Obviously it should be fairer if unrated. Thank you :-).

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

Is it rated?

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

I am getting this message please fix it "Can't read or parse problem descriptor"

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

Can we see the resolver?

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

How to solve problem E? We attempted to solve it using system of difference constraints with SPFA and got TLE. Thanks in advance.

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

Can anyone explain the solution to J? I implemented a greedy idea only to get WA on testcase 20.

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

    The main complexity in J is how to place the type-3 blocks. I decided to iterate over number of type-3 blocks to place, and then for each possibility place the blocks so that we get the fewest number of odd segments of soil using a dp (because we can fill even segments with type-2s completely, they are strictly better than odd segments).

    After the type-3 blocks are placed you can place type-1 and type-2 greedily.

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

      I have another idea. Consider all parts of consecutive cells not containing rocks. There are exactly $$$r + 1$$$ parts. Let $$$dp[i][j][1]$$$ be the maximum number of ghosts that can be repelled using at most $$$j$$$ blocks of type $$$1$$$ and last cell of this part covered by a block of type $$$3$$$. Similarly $$$dp[i][j][0]$$$ be the maximum number of ghosts that can be repelled using at most $$$j$$$ blocks of type $$$1$$$ and last cell of this part not covered by a block of type $$$3$$$. Then the dp transitions are given by

      $$$ dp[p][k][0] = \max_{j}\big(dp[p - 1][k - j][0] + jg_1 + \Bigl\lfloor \frac{a_i - j}{2} \Bigr\rfloor g_2, dp[p - 1][k - j][1] + j g_1 + \Bigl\lfloor \frac{a_i - j}{2} \Bigr\rfloor g_2 + g_3 \big)$$$

      Similarly, we can come up with dp transitions for $$$dp[i][j][1]$$$. Computing these dp values would give time complexity $$$\mathcal{O}(rk^2)$$$. But key observation is that, if we separate $$$j$$$ term and $$$k$$$ term and convert it into a range max query. So, the run time becomes $$$\mathcal{O}(rk)$$$.

      My code

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

    We need at most O(number of rocks) type-1.

    It turns out the test cases are weak, lol.

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

      may i look at your code? i couldn't see the other's code. it's for learning purpose since i keep stucking on test case 23 after debugging on test case 11,19 & 22

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

    [deleted]

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

How to solve problem K?

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

    For a subsequence $$$[l,r]$$$, you can count how many $$$A$$$ and $$$B$$$ in first element and second element of $$$f(l,r,A,B)$$$. Let them be $$$x_1,y_1$$$ and $$$x_2,y_2$$$. For example, with substring $$$ABA$$$, $$$x_1=2,y_1=3,x_2=1,y_2=2$$$.

    For query type $$$2$$$, use segment tree to calculate $$$x_i$$$ and $$$y_i$$$ of subsequence $$$[l,r]$$$. To build the tree, we need to combine $$$x_i$$$ and $$$y_i$$$ of two segment, which could be figured out by draft.

    For query type $$$1$$$, use lazy update on segment tree. When we flip a segment odd number of times, simply $$$swap(x_1, y_2)$$$ and $$$swap(x_2, y_1)$$$.

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

      Can I see your code ? Thank you very much!

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

          Can you explain the x1 y1 x2 y2 in detail? Thanks in advance!

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

            Look at the function in the statement. The return value is $$$(A,B)$$$. $$$x_1,y_1$$$ are number of original $$$A$$$ and $$$B$$$ in $$$A$$$ returned, $$$x_2,y_2$$$ are number of original $$$A$$$ and $$$B$$$ in $$$B$$$ returned.

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

              Thank you !The x1 y1 x2 y2 is like a 2 x 2 matrix . I try to use the segment tree to maintain the multiplication of the matrix,but I don't know how to change the matrix when the we flip a segment odd number of times. Now , I know it. If we flip a segment odd number of times , actually it's the transpose of this matrix. Thank you.

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

              ok but i can't understand the transition or combinations of nodes in Segment Tree.ej why ( a.x1 = (b.x1 * c.x1 + b.y1 * c.x2) % MOD; )

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

                For a segment $$$[l,r]$$$, $$$f(l,r,A,B)=(x_1\times A+y1\times b, x_2\times A + y_2\times B)=(A',B')$$$

                When combine segment $$$[l_2,r_2]$$$ next to $$$[l_1,r_1]$$$ and , $$$A'$$$ and $$$B'$$$ of the first segment become $$$A$$$ and $$$B$$$ of input of $$$f(l_2,r_2,A,B)$$$. You can make some drafts to figure out the equations.

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

    use sqrt decomposition!

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

    [deleted]

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

how and where to submit the solutions if we want to upsolve???

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

Could someone give me advice on how to solve problem G ?

EDIT: Solved using segment tree

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

    i keep getting WA on test case 2. could you please help me to find my mistake? i couldn't find my bug.

    EDIT: Solved, i did a silly mistake, i thought that Ai would be in decreasing order, i didn't read the problem carefully

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

Could someone provide insights on problem H? I got stuck on test case 5 with my solution: https://ideone.com/at2GS0 .

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

    I think it is the accuracy problem of floating point numbers.

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

    you need long double

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

      Can you tell why we needed to use long double instead of double?

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

        this test data: 1 999999999 999999999 if you use double,your answer will lose 0.5

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

          Thanks a lot for this example test case. Can you give some insights about knowing when to use normal double and when to use long double and is it good if we start using only long double from now on? I am really curious about this precision thing here. The double value can have a precision of up to 10^(-11) but still, it is going wrong for a single decimal, any reason why?

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

can anyone give me one small test case for k? I use square root decomposition .

here my solution

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

Sorry if I misunderstood something. But this contest was not in gym, right? So why I could not see another team 's code?

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

where can I find the solution

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

Will the submissions be visible?

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

pls someone write editorial blog, it will help in upsolve the problem..

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

How to solve problem I?

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

    The annoying problem, no innovative idea. The obvious thing we notice is just find the way to reach the border. Other thing I can see is that to go through two touching circles we need to follow their tangent. So we can draw lines between each pairs of circle then get some intersections,...

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

      You can draw something like voronoi diagram (but not really) by defining a half-plane using a separator between two circles (for example, a line that's exactly between two circles). By using this you can find some point from this graph you can get to and then traverse it until you can get to the end point.

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

explain me solve problem H?? please

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

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

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

Please make the test cases visible.

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

Please make testcases and other's solutions available

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

Can you please make all sources visible?

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

I try a different DP way to solve problem B but it cant pass the test 5. Can anyone make the test cases visible QAQ.

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

I need help on problem H, got WA on test 40. Here is my code. I have tried on my own test case with 8000 numbers of N, but did not spot any mistake. what do i miss?!!

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

Why are the test cases and solutions still not visible!?

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

why TLE? problem K

is that because of using vectors in representing the matrices or what?

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

Test cases for problem F cannot be more broken. You don't need to consider subtrees isomorphism in any way. Basically, if you're a tree centroid, then you're okay. Just maximize with its number of children, and you'll pass.

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

What's wrong with this code. It fails on test-5 of Even Path. https://codeforces.com/contest/1252/submission/64762718

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

jonathanirvings Test cases or other's solutions are not visible, please fix

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

    MikeMirzayanov Please fix

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

    Hi, sorry for late reply.

    I am not sure how to fix this, since I am not seeing a button in the contest admin panel to enable/disable viewing testcases or others' solutions. Please advice if you know how to do it.

    Meanwhile, as suggested in UPD2, the full problem repository of this contest has been published. You can refer to it to see the testcases. The uploaded testcases in the problem repository and in Codeforces is exactly the same (including the order).

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

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

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

May I know why in this contest we cant see other's solution.

»
10 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

jonathanirvings why tree's in the forest do not need to be isomorphic?? [test case 17]