C Board  

Go Back   C Board > Community Boards > Contests Board

Reply
 
LinkBack Thread Tools Display Modes
Old 05-11-2007, 03:10 AM   #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.
KONI is offline   Reply With Quote
Old 05-12-2007, 03:06 AM   #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 ?
KONI is offline   Reply With Quote
Old 05-12-2007, 05:01 AM   #3
Registered User
 
Queatrix's Avatar
 
Join Date: Apr 2005
Posts: 1,342
It's just a little boring.
Queatrix is offline   Reply With Quote
Old 05-12-2007, 06:25 AM   #4
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,139
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
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim
zacs7 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rooted Tree (Family tree) ch4 C Programming 4 10-14-2008 04:24 PM
Holiday in Europe laserlight General Discussions 10 06-18-2007 11:29 PM
need some help mrsirpoopsalot C Programming 64 10-17-2006 10:26 AM
Linked List of Linked lists Revisited. Qui C++ Programming 11 04-11-2004 09:45 PM
php owns your family Aran A Brief History of Cprogramming.com 6 05-19-2002 06:45 PM


All times are GMT -6. The time now is 06:58 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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