Challenge 15 - Seat Planner
The workstations in our office are spread out over 8 ‘tables’. But, all too often, we need to re-consider where everyone sits because certain people need to work side by side. Given some of these restrictions, can you help us find some valid seating arrangements?
The validator is listening in 126.96.36.199:1888. You'll need to provide “TEST” or “SUBMIT” when you connect and the validator will stream some cases with the following format:
N - Integer, number of cases (N cases follow) S - Integer, size of the table (tables are round) K - Integer, number of restrictions (K restrictions follow) I J - Restriction (I and J are two integers that must next to each other)
The seating arrangement must have 8 rows, each with one ‘table’, each table must be complete with S integers separated by ','. The integers representing the people go from 1 to S * 8
1 2 3 1 2 2 1 3 4
A valid seating arrangement with these restrictions would be:
1,2 4,3 5,6 7,8 9,10 11,12 13,14 15,16
The validator gives a little feedback for errors. The validator will send the password when all the cases have passed.
- 0 ≤ I, J, K ≤ S * 8
- S = 8 for TEST
- S = 24 for SUBMIT
Test your code
You can test your program against both the input provided in the test phase and the input provided in the submit phase. A nice output will tell you if your program got the right solution or not. You can try as many times as you want to. Be careful with extra whitespaces, the output should be exactly as described.
Test your program against the input provided in the test phase
Test your program against the input provided in the submit phase
During the submit phase, in some problems, we might give your program harder inputs. As with the test token, a nice output will tell you if your program got the right solution or not. You can try as many times as you need.
In the actual contest you first need to solve the test phase before submitting the code, you must provide the source code used to solve the challenge and you can only submit once (once your solution is submitted you won't be able to amend it to fix issues or make it faster).
If you have any doubts, please check the info section.