cry's blog

By cry, 13 days ago, In English

Judge Code will be added after hacking phase.

1996A - Legs

Problem Credits: cry
Analysis: cry

Solution

1996B - Scale

Problem Credits: sum
Analysis: cry

Solution

1996C - Sort

Problem Credits: cry
Analysis: cry

Solution

1996D - Fun

Problem Credits: sum
Analysis: cry

Solution

1996E - Decode

Problem Credits: cry
Analysis: cry

Solution

1996F - Bomb

Problem Credits: sum
Analysis: cry

Solution

1996G - Penacony

Problem Credits: cry
Analysis: cry, awesomeguy856

Solution - Segment Tree
Solution - XOR Hashing (by awesomeguy856)
  • Vote: I like it
  • +46
  • Vote: I do not like it

»
4 hours ago, # |
  Vote: I like it -8 Vote: I do not like it

cry orz

»
4 hours ago, # |
  Vote: I like it +17 Vote: I do not like it

Couldn't solve D. RIP my brute force skill.

»
4 hours ago, # |
  Vote: I like it +8 Vote: I do not like it
»
4 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

After reading problem F You realize that nuclear bombs take so much time to bomb!

  • »
    »
    4 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    sadly this is not the case in palestine!

  • »
    »
    117 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    This is because all of 1,000 nuclear bombs are false and Sparkle-sama only want to fool you, haha.

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

G reminds me of this JOISC problem

»
4 hours ago, # |
Rev. 2   Vote: I like it +7 Vote: I do not like it

In problem F: We are searching for the largest x such that f(x)≤k

Won't we reach infinity by doing that?

»
4 hours ago, # |
Rev. 5   Vote: I like it +2 Vote: I do not like it

My solution for problem F:

let's find the minimum number X, where X is the smallest number that all numbers in array a can be less or equal than using at most k operations.

then, you calculate the answer for making all the numbers in a less than X, and maintain values k and a[i] for each i.

After all you will be left with k operations, so you add to the answer : number_in_a_equal_X * k

link to my solution

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

    isn't that the same solution as mentioned in the editorial?

    oh, ohk i get it, you sped up the last part of solution by doing number_in_a_equal_X * k. That's good.

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Amazing xor-hashing solution for G, love it!

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

great contest, really fun problems. i wish i managed to solve E on time as well but oh well

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

Can anybody tell why this solution for C is getting MLE?

Submission

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

    You use map. Try replacing it with arrays and you'll be fine.

    • »
      »
      »
      25 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      yeah I also used a hashmap, but why would arrays be faster? I thought Hmaps had O(1) look up. Unless I'm misunderstanding smth

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

please can anyone explain why my code works or if it can get hacked please hack it : ), i will be so happy (https://codeforces.com/contest/1996/submission/272827778)

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

    I think it can't be hacked because worst case I found O(2 * 10^9) , and it's fast enough for your code to pass because the operations sums and multiply aren't that heavy.

    • »
      »
      »
      80 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      If in the same code we replace int by long long, it gives tle on the first test case itself. Why is this the case?

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

Can anyone explain how this code works? I don't understand it. Also, can you provide some sources that explain how it works? Thanks! 272756177

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

cry sum Is there a penalty on unsuccessful hacking attempt?

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

Thank you for the editorial ! There is just a little typo in the explanation of problem E. You wrote in the line before the last one $$$(x+1) \cdot ((n-y_1+1) + (n-y_2+2) + ... + (n-y_k+1))$$$. It shouldn't be $$$n-y_2+2$$$ but $$$n-y_2+1$$$

»
116 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Solved ABCD, hope to become pupil

»
111 minutes ago, # |
  Vote: I like it +12 Vote: I do not like it

O(n) solution of D :

wlog assume a <= b <= c

claim : atleast a, b <= √n

proof : if b > √n, b * c >= b * b > n which proves the claim so iterate on a and b till √n and count the permutations, this can be done in many ways

submission

»
104 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Why will the "remaining operations will all add (x — 1)" in the solution for F?

»
94 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

DIV 3 — C

Easiest python implementation using 26 cross n array:

272842563

»
87 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

can anyone please explain me the editorial of Problem D "Since ab+ac+bc≤n , we know at the minimum, ab≤n . " or is their any other approach please share

  • »
    »
    71 minute(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The constraint ab + ac + bc ≤ n implies that individually, each pairwise product should also be less than or equal to n . Thus, we know that:

    ab ≤ n , ac ≤ n , bc ≤ n

»
67 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Did some people really did 4th one with brute force??

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

Why I'm Getting TLE 272870887 (problem C).

»
63 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Great contest :) Hope to regain pupil title.

My math ain't mathing for D :( . What a mathy math

»
10 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

Anyone tried G with greedy then use segment tree? Like sort or pair by ascending order of min(b-a, n+a-b), assume a<b, then tried to input range [a,b] or [b,n],[1,a] to find which one is minimum. I do not know whether is works, as I tried sometimes but fail