Family Holiday

This is a discussion on Family Holiday within the Contests Board forums, part of the Community Boards category; The following is a simple challenge that I came up with for a student programming contest held nation-wide in Luxembourg. ...

  1. #1
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444

    Family Holiday

    The following is a simple challenge that I came up with for a student programming contest held nation-wide in Luxembourg. It is based on a classic problem (if you know the problem, you have the solution in no time):


    As each year, my family decided to go on holidays together, in the exact same hotel as every year. As we do not have enough money to book single-bed rooms for everyone, we have to organize ourselves to sleep in a limited number of rooms together. As in every family, some members just can't stand each other and refuse to sleep in the same room together.

    Given the amount of people that go on holiday together, the number of rooms and the relations between each of the members, determine if it is possible to organize them in such a way that they can all share rooms without any problems.

    The input is a text file with the following:
    - the first line is the number of people N
    - the second line is the number of rooms R
    - the next N lines all contain N-1 (we do not need to specify if a person hates himself or not) numbers that determine if two people hate each other (the first number in the first line determines whether person 1 likes person 2)

    Example input:
    5
    3
    1 1 0 0
    1 0 1 1
    1 0 0 0
    0 1 0 1
    0 1 0 1

    The problem should output whether it is possible to find a distribution or not. We can assume that the number of people that can sleep in the same room is infinite.

    If you know the solution, don't spoil the fun for everyone and use "invisible colors" or send me your idea by PM.

  2. #2
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    Is the problem too complicated or are you just too lazy to send your solutions in ?

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    It's just a little boring.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I agree, spice it up a little!

    Perhaps more of a challenge: Who can be the first one to complete all 151 problems on http://projecteuler.net/index.php ?
    Using C of course

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rooted Tree (Family tree)
    By ch4 in forum C Programming
    Replies: 4
    Last Post: 10-14-2008, 05:24 PM
  2. Holiday in Europe
    By laserlight in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 06-19-2007, 12:29 AM
  3. need some help
    By mrsirpoopsalot in forum C Programming
    Replies: 64
    Last Post: 10-17-2006, 11:26 AM
  4. Linked List of Linked lists Revisited.
    By Qui in forum C++ Programming
    Replies: 11
    Last Post: 04-11-2004, 10:45 PM
  5. php owns your family
    By Aran in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 05-19-2002, 07:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21