atcoder_official's blog

By atcoder_official, history, 3 months ago, In English

We will hold AtCoder Beginner Contest 338.

We are looking forward to your participation!

  • Vote: I like it
  • +61
  • Vote: I do not like it

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hope to make ABCDE!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

hope to make ABCDEF

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

ACed ABCF,but No DEG(

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ABCE here, no DFG :(

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    how did you solve F if you couldn't solve E, xD

    E is like even easier than D i think

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I don't know()

      I ACed ABCF in 31 mins.Because F's $$$n \leq 20$$$,so I thinked about its $$$O(2^n*n^2)$$$ algorithm.

      Then I thinked and debugged D until 70mins.(I'm a SB!)

      I didn't solve any problems like E before,so I didn't see it anymore() Now I know it is easy.

»
3 months ago, # |
  Vote: I like it +13 Vote: I do not like it
Me after every ABC
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I only made AB...

»
3 months ago, # |
Rev. 9   Vote: I like it -12 Vote: I do not like it

Hello everyone!I the round gone well.I hope that you all will get positive delta from this contest. Can someone explain me what is wrong in my code for E problem?

https://atcoder.jp/contests/abc338/submissions/49737722

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I mean, why that code didn't work? Can someone explain?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The condition (a[i]%2==0 && b[i]%2==0) || (a[i]%2!=0 && b[i]%2!=0) is necessary but not sufficient.

    This is a counterexample

    3
    1 4
    2 5
    3 6
    
»
3 months ago, # |
  Vote: I like it +5 Vote: I do not like it

$$$D > > > > > E$$$

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Did anyone manage to cheese $$$2^n \cdot n^3$$$ on F? I got to (32xAC,2xTLE) before realizing the $$$2^n \cdot n^2$$$ optimization and getting AC.

Also E has appeared in a previous ABC/ARC. I can't seem to find the link but the problem involved points on the sides of a square (instead of a circle) and drawing arbitrary curved lines between them (instead of chords) but the solution is identical. Granted, its an educational contest, so it probably doesn't matter too much.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the difficulity score of Problem D E F based on codeforces rating system?

»
3 months ago, # |
  Vote: I like it +14 Vote: I do not like it
A
B
C
D
E
F
G
  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it +3 Vote: I do not like it

    You don't need an RMQ data structure for E.

    I'm assuming $$$A_i \lt B_i$$$ in the following notation for simplicity. You can just swap them if they aren't, it still represents the same chord.

    Keep a stack and process the chord endpoints in order from $$$1$$$ to $$$2n$$$. When you reach $$$A_i$$$, push $$$i$$$ onto the stack. Then when you reach $$$B_i$$$, check if $$$i$$$ is on top of the stack.

    If some other value (say $$$j$$$) is on top of the stack it represents a pair of chords with $$$A_i \lt A_j \lt B_i \lt B_j$$$, i.e, chords $$$i$$$ and $$$j$$$ intersect, so it isn't possible. Otherwise no chord intersects $$$i$$$, so we just pop it from the stack and continue.

    Submission

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

D>>>>>>E>C>B>A,the worst thing is that i only WA one point in E...

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone tell why my binary search code doesn't work for C

My Code
»
3 months ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

Could someone help me figure out why doesn't my binary search solution work for C , my logic is pretty straightforward , the maximum no of times we can make dish A and B respectively are min(Qi/Ai) and min(Qi/Bi) over all i from 1 to n.

Now I binary search within 0 and (alim+blim) where alim = min(Qi/Ai) and vv. Since there are n+1 ways to represent a number as a sum of two numbers , so I iterate and find the numbers matching the condition, however my code fails the last seven test cases .

Code
  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Take a look at Ticket 17291 from CF Stress for a counter example.

    • »
      »
      »
      3 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Ah I see now , I did have a faint premonition that this might be one of the counter cases where the minimum limits for my a and b occur at the same index , I'd tried to rectify in later attempts too but due to my faulty implementation I screwed up some other test cases too.

      I eventually upsolved this problem but without binary search this time , as the binary search idea involves too much hassle. Thanks for your help btw.

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it
  • »
    »
    3 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    No offense but I would like it if you could help me figure out what's wrong with my code , if I had to look for a solution I would've read the editorial.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I did not reply to you, did I? just shared a reference for anyone searching.

      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It did seem that way from my pov , it's the first time I'm using the comment section so that might be it.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

My solution to problem F is a little bit different from the one in the editorial.

I also use dp[st][i] to denote the minimum weight under the condition that we have visited all the nodes in the bitmask of st, and we are now at the i-th node. Then, we use function numof1(st) to denote the number of 1s in st, and my algorithm works as follows.

Initially, we have dp[st][i]=0, where numof1(st)=1.

Then, suppose that we have got all the values of dp[st][i], where numof1(st)=1,2,...,k-1, and we are going to find dp[st][i], where numof1(st)=k, by using dp[st'][j], where numof1(st')=k-1. For dp[st'][j], we can go to any dp[st][i], if and only if, st=st' | (1<<i), and there is an edge from node-j to node-i.

Next, for any dp[st][i], we find all the nodes involved in st, and update dp[st][i] again, by using Dij algorithm.

Finally, the answer is the minimum one of dp[(1<<n)-1][i].

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi,everybody,I found a problem in E Here is the Sample Input 3 114 514 512 113 115 513

But Atcoder's Output is No and somebody's AC code'output is No But somebody's AC code'output is Yes and I try drawing a picture,I found that there is an intersection between the chords, Can you help me?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

link to my submission for problem C in atcoder beginner contest 338

help me in debugging this code please..I am getting WA only for the middle two test files