Comments
+15

Quite a few, actually! Whenever I'm stuck in a question or not able to find an easy/faster way to implement the solution I have in mind, I refer to their solutions.

Hope that helps!

I've uploaded solutions to CSES Graph and CSES DP too! I haven't solved all the questions, but you guys can check them out if you need help!

Let's break it down into 2 subcases.

Claim 1: Let's say the 1st person is not a liar. Therefore his statement is true. So out of the leftover 3 people, the number of liars should be atleast 2. So either 2 of them are liars or all 3 are liars. If only 2 of them are liars, they should lie and report atleast 3 as their answer. Since this is not the case, all 3 of them should be liars. Because all 3 are liars, they should lie and report that there are atleast 4 liars. Since even this is not the case, therefore our claim 1 is false.

Now we are only left with the option that 1st person is a liar. Let this be claim 2. Since he is a liar, his statement is false. Therefore the no. of liars should be strictly less than 2. But since we are still left with 3 people who are saying the no. of liars should be atleast 2, therefore these 3 should also be liars. This is a contradiction and hence claim 2 is also false.

Hence we can conclude that all of them are contradicting each other and return -1 as the answer.

This much is obvious that the number of liars can range anywhere between [0, n] inclusive. Say the no. of liars is L.

From the statement: Some of them might be liars, who always tell lies. The i-th person says "There are at least L liars amongst us".

Since liars always tell lies, they will surely say that the no. of liars are atleast L+1. So these people will always report a value >= L+1

So, if for some value of liars = L, if you are able to find exactly L people who say liars are > L then that means that L is actually the correct no. of liars.

You can iterate over all all possible values of L and check.

AC submission: 204649911

Thank you so much, I understand it now!

okwedook I still don't understand why 2 queries aren't enough in F. Is it not ok to get the x coordinates through projection on y = 0 and y coordinates through projection on x = 0? It is also written that ans should be correct till 3 decimal places and since the noise is < 10−4 for each point through the query, shouldn't we be good?

Can someone please explain to me the logic behind jiangly's code for D2? This is his submission: 164761716

yeah, you're right! thanks

EDIT : Got the failing test case. Thanks!

Can someone tell me why my code : https://mirror.codeforces.com/contest/1690/submission/159863108 is giving index out of bounds, also do tell the test case that is failing. Thanks!