Comments
On Jim_X → Problem B of todays contest, 8 months ago
+6

Sorry for the issue. We didn't notice this before the contest. Actually, the authors proposed problem B in mid-December last year, so I believe it's just a coincidence.

+69

I tried to hack my C but I received an Unexpected Verdict. It seems that there is a solution on Polygon that use int but it was marked as AC.

Problem F almost = This Problem

+16

Problem E almost = This Problem

Problem D is similar to this problem which I proposed to codechef before.

The same problem also appeared in IZhO 2019.

Link

Here is the hack test:

1
5
1 3 2 3 4

Your solution will modify two numbers, but it's optimal to replace the third number with 3.

If the last two bit of the binary representation of x is 00, we need to continue finding possible parents. But if the last two bit is 10, we need to stop finding since the operation is * 4 and there are no parents that can generate it.

So in my implementation, I use x & 3 to check whether the second last bit is 1 or not. It can be replaced with x % 4 or x & 2. The latter is because I have checked the last bit is 0.

Well, that is because in my implementation, I sort the segments in the increasing order of their right endpoints. This way I'll need to maintain the suffix minimum. It doesn't matter a lot since the basic idea is still sweep line.

Sorry, we will fix it later.

As a tester, I believe all of you will enjoy these excellent probelms.

+20

The input validator of Problem G is also wrong

I use this testcase and successful hack

1
10000001
+3

ANDAC = ANDAB & ANDBC;

Well, This is wrong.

eg) a = 1, b = 0, c = 1

a & c is 1 but (a & b) & (b & c) is 0.

I can't hack my solution because of this, either:(

On Noob-ita-coder → Limits of Hashing, 7 years ago
+2

According to the birthday paradox, if m = 1e9 + 9, we can random about 200000 strings and the possibility of collisions is more than 99.9999%!

Simple code can calculate the possibility:

int m = 1e9 + 9;
double x = 1;
for (int i = 0; i < 200000; ++i) {
    x = x * (m - i) / m;
}
x = 1.0 - x;
cout << fixed << setprecision(11) << x << endl;

Also, if you want to make your hashing become hard to hack, there are two possible choice:

  1. use a long long prime as m

  2. use two or more hash functions

Sorry for my poor English, I hope this can help you:)