Late Christmas Shopping

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type

Did you know that eagles hibernate? At least, one eagle does. When the winter break started, FatalEagle decided that he would retreat into his mancave for a little while to hibernate and take a break from all the hustle-bustle of school life. But when he finally came out, he discovered that he had missed Christmas and it was already the New Year! What a disaster! If he doesn't get the other DMOJ admins their presents, they will definitely refuse when he asks them to be his data slaves!

Luckily, there's a special store where the boxing week sales are still going on so FatalEagle can still get some cheap presents. FatalEagle brought N shopping bags with him, one for each DMOJ admin's presents. FatalEagle is known for being a calm, cool, and collected shopper normally. When browsing the aisles of the store however, he found that their prices were unbelievably low! Amazed at his luck, FatalEagle went on a shopping spree, grabbing all that he could and shoving them into his shopping bags indiscriminately.

It was only when he lined up for the checkout that he realized he may have made a mistake. What if two or more DMOJ admins end up getting the same present? FatalEagle can't let his reputation as a great gifter be soiled like that! As the nice cashier of the store, you have agreed to help FatalEagle check if multiple bags contain the same item.

Input Specification

The first line of input will contain N (1 \le N \le 3), the number of shopping bags.

Each of the next N lines will contain M (1 \le M \le 3), the number of items in that bag, followed by M integers, the label of each item. The labels of the items will be between 1 and 10, inclusive.

Output Specification

Output YES if there's at least one gift that multiple admins will get, otherwise, output NO.

Sample Input 1

3 1 2 3
3 2 4 6

Sample Output 1


Explanation for Sample Output 1

Both admins will get item 2.

Sample Input 2

3 1 3 5
3 2 4 6

Sample Output 2



  • 2
    r3mark  commented on Jan. 2, 2016, 12:28 a.m.

    I had 75 points on this problem until just now. The best submissions page says that I had submitted a 100 point solution 12 hours ago. What? Is this related to the fact that the Java judge was broken until recently?

    • 2
      Xyene  commented on Jan. 2, 2016, 12:36 a.m. edited

      There was an issue with one of the judges syncing (the third-party service we use broke), and as a result all submissions for this problem are being rejudged. The Java judge was a separate issue that has also been resolved.

  • 5
    maxhflow  commented on Jan. 1, 2016, 11:55 p.m. edited

    I've submitted several solutions that I've proved the correctness of and received WA. So clearly there is some trick to interpreting what the question actually asks.

    There are N lists of numbers between 1 and 10. If there is any pair of lists that contain the same number, output "YES", otherwise output "NO". If a single list contains a number more than once, we ignore it. In other words, we treat the lists like sets. (Note that I've also tried solutions that do not ignore multiple items in the same list, and output "YES" in this case; same WA verdict.)

    Is this the correct interpretation? If not, could you please rephrase the question. It is my opinion that "trick" questions should not have a place in competitive programming, as English is not the first language of many competitors. Also, I have dyslexia, and struggle to read such problem statements.

    • 7
      Xyene  commented on Jan. 2, 2016, 12:34 a.m.

      Yes, you have interpreted the question correctly - the issue was on our side, and is now being resolved. One of the four judges running this contest had not synced the last case of the problem correctly (a bug in the file syncing software we use), leading to Wrong Answer verdicts on the last case. All submissions for this problem are now being rejudged.

      We are sorry for the inconvenience this issue may have caused. Happy new year!

      • 5
        maxhflow  commented on Jan. 2, 2016, 12:39 a.m.

        Thanks! No worries :)

  • -1
    imthekiller  commented on Jan. 1, 2016, 5:02 p.m.

    Please i'm new to programming i need help what does "Your output (clipped)" mean?

    • 3
      odaniel  commented on Jan. 1, 2016, 5:06 p.m.

      It's a little hint the website gives you as to why your program failed called partial output - it gives you a small portion of your code's output. However, the partial output sometimes doesn't play nicely with the question, and so the partial output is zero. Basically, you get no help :) good luck!

      • 0
        imthekiller  commented on Jan. 1, 2016, 5:17 p.m.

        one last question please : do we need to make input conditions for N and M?

        • 0
          odaniel  commented on Jan. 1, 2016, 5:40 p.m.

          What does that mean? The answer is always YES or NO.

  • 3
    aurpine  commented on Jan. 1, 2016, 1:39 p.m.

    I think the last test case is wrong, or it exceeds the input constraints.

    (and I don't know why I'm getting WA :'( )

    • 0
      XIAOAGE  commented on Jan. 1, 2016, 5:21 p.m.

      Yea, I have used 5 approaches. All give me WA :(

      • 1
        odaniel  commented on Jan. 1, 2016, 5:41 p.m.

        Keep looking. There's something that you've missed.

    • 0
      cheesecake  commented on Jan. 1, 2016, 1:45 p.m.

      I've just checked it. It's correct and fits within the constraints.

  • 0
    hamzaouni7  commented on Jan. 1, 2016, 12:39 p.m.

    no pascal ??

    • 0
      cheesecake  commented on Jan. 1, 2016, 12:43 p.m.

      All languages are now available, sorry for the inconvenience.