Anyone could help? Does anyone know interesting input or where I could find them?
Txs a lot!
Moderator: Board moderators
a. make all the politicians available
b. for each of the four days
1. consider an empty list (L) of politicians for that day.
2. add the first available politician to L.
3. for every other available politician, add him/her in L only if s/he is in good terms with all the politicians already in L.
4. make all the politicians in L unavailable
Adil wrote:hello. this is how i solved the prob:
- Code: Select all
a. make all the politicians available
b. for each of the four days
1. consider an empty list (L) of politicians for that day.
2. add the first available politician to L.
3. for every other available politician, add him/her in L only if s/he is in good terms with all the politicians already in L.
4. make all the politicians in L unavailable
hope this helps.
wyvmak wrote:I wanna say something.
first, the judge is wrong.
actually i think this is an NP-complete problem,
but Adil's algorithm works, which is polynomial running time.
i first guess this is just an approximation algorithm,
but, after the algorithm, i verified that it doesn't invite all the politicians!
the judge is wrong, but this incorrect algorithm can be accepted.
second, don't output the line between consecutive cases, at least if i remove that line of code to put the extra line, the difference is WA and PE!
1
6 12
A
B
C
D
E
F
A D
A E
A F
B C
B D
B E
C D
C E
C F
D E
D F
E FUsers browsing this forum: No registered users and 1 guest