You are not logged in. Please login at to post your questions!


Editorial for GARGOYLE - PELT2019

Difficulty: Easy

Problem setter: panik

Prerequisites: Implementations, usage of maps/dictionary(if in python).

Explanation: I this question for statements to not contradict, all the statement arrays of the selected people should be similar. We can do this by taking the count of each distinct array with the help of maps and then Iterating all of them and finding the maximum count with the correct Statements.
Note: A statement array will only be considered correct if the count of True in it is equal to the count of that type of substring. This could be seen in sample Test case 2. Although the count of T T T was 2, the final answer was 1 because according to them all of them were true speaking by according to the 3rd person, he only considered himself to be a true speaking person.

Time complexity: O(nlog(n)) -> log(n) factor occurs due to usage of maps.

Author's Solution: click here

Tester's Solution: click here

asked 11 Jan, 18:04

panik's gravatar image

accept rate: 7%

edited 12 Jan, 01:19

@panik can you please tell me why my code is wrong ? I did exactly same what is mentioned in the editorial, and repeatedly got WA during the contest.



answered 11 Jan, 18:51

arjitkansal's gravatar image

accept rate: 0%

edited 11 Jan, 20:54

Can anyone help me why my submission is getting wrong answer? I am doing same thing as mentioned above. Link


answered 11 Jan, 19:11

parth_patel15's gravatar image

accept rate: 0%

edited 11 Jan, 19:23

@parth_patel15 You've added a link of the submission page. Add the link to the submitted solution.

(11 Jan, 19:14) arjitkansal5★

Updated. My solution is same as yours. Don't know why it gets WA.

(11 Jan, 19:24) parth_patel154★

Similar thing happened in Sept 2018 Lunchtime as well where the solution got WA during the contest but got AC in practice section. At that time as well, there was no reply from the admin or the author and the contest was kept as rated.

(11 Jan, 20:53) arjitkansal5★

Hi parth, your solution is wrong because you have set ans=1 but ans can be 0 as well

(12 Jan, 01:04) panik5★

@panik @admin @vijju123 Kindly check, the tester's solution is even getting a WA



answered 11 Jan, 21:04

arjitkansal's gravatar image

accept rate: 0%

edited 11 Jan, 21:06

Hi arjit, I am looking into your solution although its giving the correct ans on codechef compiler on the TC on which your solution is showing wrong, i am looking into it. @vijju123 can you please have a look

(12 Jan, 01:06) panik5★

Sorry wrong tester solution file was attached, the file is updated, please have a look

(12 Jan, 01:23) panik5★

@panik Let me know once you find the mistake :)

(12 Jan, 10:53) arjitkansal5★

@panik Did you find the mistake ?

(13 Jan, 17:03) arjitkansal5★

@panik @admin @vijju123 anyone could you please bother to reply?

(yesterday) arjitkansal5★

@panik Can you please explain the output for the Sample Case 2 in a litle more detailed way? Still not able to get it.


answered 12 Jan, 02:45

dipanshu_10297's gravatar image

accept rate: 0%

see the first 2 people consider everyone to be a truth speaking person, but the 3rd person doesn't think so, so we cannot cosider to T T T statement to be correct. No if we pick the F F T statement then according to him only the 3rd person is correct and this does not contradict with any statement as only 1 person is in set and the count of T in statement is 1 also, so ans is 1

(12 Jan, 11:54) panik5★

I do not understand how is the time complexity of the suggested solution nlogn. I think that the time complexity of the solution is (n^2)logn. Can you please explain?


answered 1 hour ago

ankit_btech's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 11 Jan, 18:04

question was seen: 271 times

last updated: 1 hour ago